From 67fdec20726e48ba3a934cb25bb30d47ec4a4f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20De=20La=20Pe=C3=B1a=20Smirnov?= Date: Wed, 29 Nov 2017 11:44:34 +0300 Subject: Initial commit, version 0.5.3 --- node_modules/ultron/LICENSE | 22 +++++++ node_modules/ultron/index.js | 138 +++++++++++++++++++++++++++++++++++++++ node_modules/ultron/package.json | 112 +++++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 node_modules/ultron/LICENSE create mode 100644 node_modules/ultron/index.js create mode 100644 node_modules/ultron/package.json (limited to 'node_modules/ultron') diff --git a/node_modules/ultron/LICENSE b/node_modules/ultron/LICENSE new file mode 100644 index 0000000..6dc9316 --- /dev/null +++ b/node_modules/ultron/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Unshift.io, Arnout Kazemier, the 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/ultron/index.js b/node_modules/ultron/index.js new file mode 100644 index 0000000..9e0677a --- /dev/null +++ b/node_modules/ultron/index.js @@ -0,0 +1,138 @@ +'use strict'; + +var has = Object.prototype.hasOwnProperty; + +/** + * 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 + , ee = this.ee + , 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) { + if (ee.eventNames) { + args = ee.eventNames(); + } else if (ee._events) { + args = []; + + for (event in ee._events) { + if (has.call(ee._events, event)) args.push(event); + } + + if (Object.getOwnPropertySymbols) { + args = args.concat(Object.getOwnPropertySymbols(ee._events)); + } + } + } + + for (var i = 0; i < args.length; i++) { + var listeners = ee.listeners(args[i]); + + for (var j = 0; j < listeners.length; j++) { + event = listeners[j]; + + // + // Once listeners have a `listener` property that stores the real listener + // in the EventEmitter that ships with Node.js. + // + if (event.listener) { + if (event.listener.__ultron !== this.id) continue; + delete event.listener.__ultron; + } else { + if (event.__ultron !== this.id) continue; + delete event.__ultron; + } + + 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/ultron/package.json b/node_modules/ultron/package.json new file mode 100644 index 0000000..ca5afc3 --- /dev/null +++ b/node_modules/ultron/package.json @@ -0,0 +1,112 @@ +{ + "_args": [ + [ + { + "raw": "ultron@~1.1.0", + "scope": null, + "escapedName": "ultron", + "name": "ultron", + "rawSpec": "~1.1.0", + "spec": ">=1.1.0 <1.2.0", + "type": "range" + }, + "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/ws" + ] + ], + "_from": "ultron@>=1.1.0 <1.2.0", + "_id": "ultron@1.1.0", + "_inCache": true, + "_location": "/ultron", + "_nodeVersion": "6.2.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/ultron-1.1.0.tgz_1483969751660_0.8877595944795758" + }, + "_npmUser": { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + }, + "_npmVersion": "3.9.3", + "_phantomChildren": {}, + "_requested": { + "raw": "ultron@~1.1.0", + "scope": null, + "escapedName": "ultron", + "name": "ultron", + "rawSpec": "~1.1.0", + "spec": ">=1.1.0 <1.2.0", + "type": "range" + }, + "_requiredBy": [ + "/ws" + ], + "_resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.0.tgz", + "_shasum": "b07a2e6a541a815fc6a34ccd4533baec307ca864", + "_shrinkwrap": null, + "_spec": "ultron@~1.1.0", + "_where": "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/ws", + "author": { + "name": "Arnout Kazemier" + }, + "bugs": { + "url": "https://github.com/unshiftio/ultron/issues" + }, + "dependencies": {}, + "description": "Ultron is high-intelligence robot. It gathers intel so it can start improving upon his rudimentary design", + "devDependencies": { + "assume": "1.4.x", + "eventemitter3": "2.0.x", + "istanbul": "0.4.x", + "mocha": "~3.2.0", + "pre-commit": "~1.2.0" + }, + "directories": {}, + "dist": { + "shasum": "b07a2e6a541a815fc6a34ccd4533baec307ca864", + "tarball": "https://registry.npmjs.org/ultron/-/ultron-1.1.0.tgz" + }, + "gitHead": "6eb97b74402978aebda4a9d497cb6243ec80c9f1", + "homepage": "https://github.com/unshiftio/ultron", + "keywords": [ + "Ultron", + "robot", + "gather", + "intelligence", + "event", + "events", + "eventemitter", + "emitter", + "cleanup" + ], + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "name": "unshift", + "email": "npm@unshift.io" + }, + { + "name": "v1", + "email": "info@3rd-Eden.com" + }, + { + "name": "3rdeden", + "email": "npm@3rd-Eden.com" + } + ], + "name": "ultron", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/unshiftio/ultron.git" + }, + "scripts": { + "100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100", + "coverage": "istanbul cover _mocha -- test.js", + "test": "mocha test.js", + "test-travis": "istanbul cover _mocha --report lcovonly -- test.js", + "watch": "mocha --watch test.js" + }, + "version": "1.1.0" +} -- cgit v1.2.3