flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

View file

@ -0,0 +1,26 @@
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

27
VISUALIZACION/node_modules/ngraph.events/LICENSE generated vendored Executable file
View file

@ -0,0 +1,27 @@
Copyright (c) 2013-2022 Andrei Kashcha
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.
Neither the name of the Andrei Kashcha nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
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.

66
VISUALIZACION/node_modules/ngraph.events/README.md generated vendored Executable file
View file

@ -0,0 +1,66 @@
ngraph.events
=============
Small and powerful eventing in node and browser
[![build status](https://github.com/anvaka/ngraph.events/actions/workflows/tests.yaml/badge.svg)](https://github.com/anvaka/ngraph.events/actions/workflows/tests.yaml)
Example
=======
``` js
var eventify = require('ngraph.events');
var yourObject = {}; // any javascript object
eventify(yourObject);
// now any object can listen to events from your object
yourObject.on('beep', function(name) { console.log('Hello ' + name); });
// and you can fire events from your object:
yourObject.fire('beep', 'World!'); // prints 'Hello World!'
// stop listen to events:
yourObject.off('beep');
```
More advanced examples:
``` js
var eventify = require('ngraph.events');
var yourObject = eventify({});
// Pass context to event handler as last argument:
yourObject.on('beep', function () { console.log(this === yourObject); }, yourObject);
yourObject.fire('beep'); // prints true;
// Pass additional arguments to fire:
var onBop = function (x, y) { console.log(x + y); };
yourObject.on('bop', onBop);
yourObject.fire('bop', 40, 2); // prints 42;
// Remove given event handler for 'bop' event
yourObject.off('bop', onBop);
// Remove all event listeners from your object:
yourObject.off();
```
Why?
===
I wanted a light-weight eventing library, so I built this.
Install
=======
With [npm](http://npmjs.org) do:
```
npm install ngraph.events
```
License
=======
BSD 3-Clause

24
VISUALIZACION/node_modules/ngraph.events/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,24 @@
// Type definitions for ngraph.events v1.0.0
// Project: https://github.com/anvaka/ngraph.graph
// Definitions by: Tobias Kopelke <https://github.com/lordnox>
declare module "ngraph.events" {
// define keys that are allowed as event names
export type EventKey = string | number | Symbol
// define basic function that is allowed for event listeners
export type EventCallback = (...args: any[]) => void
// defined additional event properties that will be added by eventify
export interface EventedType {
on: (eventName: EventKey, callback: EventCallback, ctx?: any) => this
off: (eventName?: EventKey, callback?: EventCallback) => this
fire: (eventName: EventKey, ...args: any[]) => this
}
// extend generic object type as Generic but remove the on, off, fire properties
export default function eventify<Type extends {}>(subject: Type & {
on?: never
off?: never
fire?: never
}): EventedType & Type
}

88
VISUALIZACION/node_modules/ngraph.events/index.js generated vendored Executable file
View file

@ -0,0 +1,88 @@
module.exports = function eventify(subject) {
validateSubject(subject);
var eventsStorage = createEventsStorage(subject);
subject.on = eventsStorage.on;
subject.off = eventsStorage.off;
subject.fire = eventsStorage.fire;
return subject;
};
function createEventsStorage(subject) {
// Store all event listeners to this hash. Key is event name, value is array
// of callback records.
//
// A callback record consists of callback function and its optional context:
// { 'eventName' => [{callback: function, ctx: object}] }
var registeredEvents = Object.create(null);
return {
on: function (eventName, callback, ctx) {
if (typeof callback !== 'function') {
throw new Error('callback is expected to be a function');
}
var handlers = registeredEvents[eventName];
if (!handlers) {
handlers = registeredEvents[eventName] = [];
}
handlers.push({callback: callback, ctx: ctx});
return subject;
},
off: function (eventName, callback) {
var wantToRemoveAll = (typeof eventName === 'undefined');
if (wantToRemoveAll) {
// Killing old events storage should be enough in this case:
registeredEvents = Object.create(null);
return subject;
}
if (registeredEvents[eventName]) {
var deleteAllCallbacksForEvent = (typeof callback !== 'function');
if (deleteAllCallbacksForEvent) {
delete registeredEvents[eventName];
} else {
var callbacks = registeredEvents[eventName];
for (var i = 0; i < callbacks.length; ++i) {
if (callbacks[i].callback === callback) {
callbacks.splice(i, 1);
}
}
}
}
return subject;
},
fire: function (eventName) {
var callbacks = registeredEvents[eventName];
if (!callbacks) {
return subject;
}
var fireArguments;
if (arguments.length > 1) {
fireArguments = Array.prototype.splice.call(arguments, 1);
}
for(var i = 0; i < callbacks.length; ++i) {
var callbackInfo = callbacks[i];
callbackInfo.callback.apply(callbackInfo.ctx, fireArguments);
}
return subject;
}
};
}
function validateSubject(subject) {
if (!subject) {
throw new Error('Eventify cannot use falsy object as events subject');
}
var reservedWords = ['on', 'fire', 'off'];
for (var i = 0; i < reservedWords.length; ++i) {
if (subject.hasOwnProperty(reservedWords[i])) {
throw new Error("Subject cannot be eventified, since it already has property '" + reservedWords[i] + "'");
}
}
}

25
VISUALIZACION/node_modules/ngraph.events/package.json generated vendored Executable file
View file

@ -0,0 +1,25 @@
{
"name": "ngraph.events",
"version": "1.2.2",
"description": "Basic events supoort for ngraph.js ",
"main": "index.js",
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "https://github.com/anvaka/ngraph.events.git"
},
"keywords": [
"ngraph",
"ngraphjs"
],
"author": "Andrei Kashcha",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/anvaka/ngraph.events/issues"
},
"devDependencies": {
"tap": "^16.2.0"
}
}

35
VISUALIZACION/node_modules/ngraph.events/test/errors.js generated vendored Executable file
View file

@ -0,0 +1,35 @@
var test = require('tap').test,
eventify = require('..');
test('Eventify protects your object', function(t) {
t.plan(1);
try {
eventify({
on: "I'm a dummy string, please don't wipe me out"
});
} catch (e) {
t.ok(true, 'Eventify should thrown an exception to protect your object');
}
t.end();
});
test('Eventify does not allow falsy objects', function(t) {
t.plan(1);
try {
eventify(false);
} catch (e) {
t.ok(true, 'Eventify should thrown an exception to protect your object');
}
t.end();
});
test('Eventify does not allow to subscribe without function', function(t) {
t.plan(1);
var subject = eventify({});
try {
subject.on('foo')
} catch (e) {
t.ok(true, 'Eventify should thrown an exception: no function is specified');
}
t.end();
});

181
VISUALIZACION/node_modules/ngraph.events/test/fire.js generated vendored Executable file
View file

@ -0,0 +1,181 @@
var test = require('tap').test,
eventify = require('..');
test('fire fires callback', function(t) {
var subject = {};
eventify(subject);
t.plan(1);
subject.on('something', function (){
t.ok(true, 'fired callback');
});
subject.fire('something');
t.end();
});
test('fire fires all callbacks', function(t) {
t.plan(2);
var subject = eventify({});
var onSomething = function (){
t.ok(true, 'fired callback');
};
subject.on('something', onSomething);
subject.on('something', onSomething);
subject.fire('something');
t.end();
});
test('Chaining can be used on fire and "on"', function(t) {
t.plan(2);
var subject = eventify({});
var onSomething = function (){
t.ok(true, 'fired callback');
};
subject.on('beep', onSomething).on('bop', onSomething);
subject.fire('beep').fire('bop');
t.end();
});
test('fire passes all arguments', function(t) {
t.plan(2);
var subject = eventify({});
var testX = 42,
testY = 'hello';
subject.on('something', function (x, y){
t.equal(x, testX, "X argument should be expected");
t.equal(y, testY, "Y argument should be expected");
});
subject.fire('something', testX, testY);
t.end();
});
test('"on" and fire preserves the context', function(t) {
var subject = eventify({});
var context = {};
subject.on('something', function (){
t.equal(this, context, "On should be called with expected context");
}, context);
subject.fire('something');
t.end();
});
test('"off" removes passed listener', function(t) {
t.plan(1);
var subject = eventify({});
var context = {};
var onFoo = function (){
t.ok(false, "off() did not properly removed the handler");
};
var onBar = function (){
t.ok(true, "off() removed bar handler");
};
subject.on('foo', onFoo);
subject.on('bar', onBar);
subject.off('foo', onFoo);
subject.fire('foo');
subject.fire('bar');
t.end();
});
test('"off" removes only one from the same event name', function(t) {
t.plan(1);
var subject = eventify({});
var context = {};
var onFoo1 = function (){
t.ok(false, "off() did not properly removed the handler");
};
var onFoo2 = function (){
t.ok(true, "off() removed wrong handler");
};
subject.on('foo', onFoo1);
subject.on('foo', onFoo2);
subject.off('foo', onFoo1);
subject.fire('foo');
t.end();
});
test('"off" removes all for given event name', function(t) {
t.plan(0);
var subject = eventify({});
var context = {};
var onFoo = function (){
t.ok(false, "off() did not properly removed the handler");
};
subject.on('foo', onFoo);
subject.off('foo');
subject.fire('foo');
});
test('"off" removes all events', function(t) {
t.plan(0);
var subject = eventify({});
var onFoo = function (){
t.ok(false, "off() did not properly removed the handler");
};
subject.on('foo', onFoo);
subject.on('bar', onFoo);
subject.off();
subject.fire('foo');
subject.fire('bar');
});
test('"off" does not harm when no such event', function(t) {
t.plan(1);
var subject = eventify({});
var onFoo = function () {
t.ok(true, "off() called just one");
};
subject.on('foo', onFoo);
subject.off('bar', onFoo);
subject.fire('foo');
subject.fire('bar');
});
test('"off" can remove by function', function(t) {
t.plan(1);
var subject = eventify({});
var onFooYes = function () {
t.ok(true, "off() called just one");
};
var onFooNo = function () {
t.ok(false, "off() should not be called");
};
subject.on('foo', onFooYes);
subject.on('foo', onFooNo);
subject.off('foo', onFooNo);
subject.fire('foo');
});
test('eventify can chain', function(t) {
var subject = {};
var eventifiedSubject = eventify(subject);
t.ok(subject === eventifiedSubject, "eventified result should be the same as subject");
t.end();
});