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

20
VISUALIZACION/node_modules/serialize-to-js/LICENSE generated vendored Executable file
View file

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2016-present commenthol
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.

180
VISUALIZACION/node_modules/serialize-to-js/README.md generated vendored Executable file
View file

@ -0,0 +1,180 @@
# serialize-to-js
> serialize objects to javascript
[![NPM version](https://badge.fury.io/js/serialize-to-js.svg)](https://www.npmjs.com/package/serialize-to-js/)
[![Build Status](https://secure.travis-ci.org/commenthol/serialize-to-js.svg?branch=master)](https://travis-ci.org/commenthol/serialize-to-js)
Serialize objects into a `require`-able module while checking circular structures and respecting references.
The following Objects are supported
- String
- Number
- Boolean
- Object
- Array
- RegExp
- Error
- Date
- Buffer
- Int8Array, Uint8Array, Uint8ClampedArray
- Int16Array, Uint16Array
- Int32Array, Uint32Array, Float32Array
- Float64Array
## Table of Contents
<!-- !toc (minlevel=2 omit="Table of Contents") -->
* [Methods](#methods)
* [serialize](#serialize)
* [deserialize](#deserialize)
* [serializeToModule](#serializetomodule)
* [Contribution and License Agreement](#contribution-and-license-agreement)
* [License](#license)
<!-- toc! -->
## Methods
### serialize
`serialize(source, opts, opts.ignoreCircular, opts.reference)`
serializes an object to javascript
#### Example - serializing regex, date, buffer, ...
```js
var serialize = require('serialize-to-js').serialize;
var obj = {
str: '<script>var a = 0 > 1</script>',
num: 3.1415,
bool: true,
nil: null,
undef: undefined,
obj: { foo: 'bar' },
arr: [1, '2'],
regexp: /^test?$/,
date: new Date(),
buffer: Buffer.from('data'),
}
console.log(serialize(obj))
// > {str: "\u003Cscript\u003Evar a = 0 \u003E 1\u003C\u002Fscript\u003E", num: 3.1415, bool: true, nil: null, undef: undefined, obj: {foo: "bar"}, arr: [1, "2"], regexp: /^test?$/, date: new Date("2016-04-15T16:22:52.009Z"), buffer: new Buffer('ZGF0YQ==', 'base64')}
```
#### Example - serializing while respecting references
```js
var serialize = require('serialize-to-js').serialize;
var obj = { object: { regexp: /^test?$/ } };
obj.reference = obj.object;
var opts = { reference: true };
console.log(serialize(obj, opts));
//> {object: {regexp: /^test?$/}}
console.log(opts.references);
//> [ [ '.reference', '.object' ] ]
```
**Parameters**
**source**: `Object | Array | function | Any`, source to serialize
**opts**: `Object`, options
**opts.ignoreCircular**: `Boolean`, ignore circular objects
**opts.reference**: `Boolean`, reference instead of a copy (requires post-processing of opts.references)
**opts.unsafe**: `Boolean`, do not escape chars `<>/`
**Returns**: `String`, serialized representation of `source`
### deserialize
`deserialize(str, [context])`
deserialize a serialized object to javascript
> _NOTE_: Deserialization uses `new Function()` for code evaluation which may be "harmful".
> **SO NOW YOU ARE WARNED!**
Uses [safer-eval][] for deserialization.
#### Example - deserializing regex, date, ...
```js
var str = '{obj: {foo: "bar"}, arr: [1, "2"], regexp: /^test?$/, date: new Date("2016-04-15T16:22:52.009Z")}'
var res = deserialize(str)
console.log(res)
//> { obj: { foo: 'bar' },
//> arr: [ 1, '2' ],
//> regexp: /^test?$/,
//> date: Sat Apr 16 2016 01:22:52 GMT+0900 (JST) }
```
**Parameters**
**str**: `String`, string containing serialized data
**context**: (optional) pass context e.g. if requiring Buffer use `{Buffer: Buffer}`.
**Returns**: `Any`, deserialized data
### serializeToModule
`serializeToModule(source, opts, opts.ignoreCircular, opts.reference, opts.comment, opts.beautify) `
serialize to a module which can be `require`ed.
#### Example - serializing while respecting references
```js
var serialTM = require('serialize-to-js').serializeToModule;
var obj = { object: { regexp: /^test?$/ } };
obj.reference = obj.object;
console.log(serialTM(obj, { reference: true }));
//> var m = module.exports = {
//> object: {
//> regexp: /^test?$/
//> }
//> };
//> m.reference = m.object;
```
**Parameters**
**source**: `Object | Array | function | Any`, source to serialize
**opts**: `Object`, options
**opts.ignoreCircular**: `Boolean`, ignore circular objects
**opts.reference**: `Boolean`, reference instead of a copy (requires post-processing of opts.references)
**opts.comment**: `Boolean`, add a comments - useful for linting tools e.g. using 'eslint-disable'
**opts.beautify**: `Boolean | Object`, beautify output - default is `false`. If Object then use je-beautify options.
**opts.unsafe**: `Boolean`, do not escape chars `<>/`
**Returns**: `String`, serialized representation of `source` as module
## Contribution and License Agreement
If you contribute code to this project, you are implicitly allowing your
code to be distributed under the MIT license. You are also implicitly
verifying that all code is your original work or correctly attributed
with the source of its origin and licence.
## License
Copyright (c) 2016- commenthol (MIT License)
See [LICENSE][] for more info.
[LICENSE]: ./LICENSE
[safer-eval]: https://github.com/commenthol/safer-eval

View file

@ -0,0 +1,37 @@
/*
* @copyright 2016- commenthol
* @license MIT
*/
/* eslint no-new-func: 0 */
'use strict'
var saferEval = require('safer-eval')
/**
* deserialize a serialized object to javascript
*
* _NOTE_: Deserialization uses `safer-eval` for code evaluation which may be "harmful".
* *So now you are WARNED!*
*
* @example <caption>serializing regex, date, buffer, ...</caption>
* var str = '{obj: {foo: "bar"}, arr: [1, "2"], regexp: /^test?$/, date: new Date("2016-04-15T16:22:52.009Z")}'
* var res = deserialize(str)
* console.log(res)
* //> { obj: { foo: 'bar' },
* //> arr: [ 1, '2' ],
* //> regexp: /^test?$/,
* //> date: Sat Apr 16 2016 01:22:52 GMT+0900 (JST) }
*
* @throws {Error|TypeError} parsing error
* @param {String} str - string containing serialized data
* @param {Object|Boolean} [context] - pass context - if `true` unsafe execution
* @return {Any} deserialized data
*/
function deserialize (str, context) {
if (context === true) {
return (new Function('"use strict"; return ' + str))() // unsafe execution
}
return saferEval(str, context)
}
module.exports = deserialize

5
VISUALIZACION/node_modules/serialize-to-js/lib/index.js generated vendored Executable file
View file

@ -0,0 +1,5 @@
module.exports = {
serialize: require('./serialize'),
serializeToModule: require('./serializeToModule'),
deserialize: require('./deserialize')
}

View file

@ -0,0 +1,90 @@
/*
* @copyright 2015- commenthol
* @license MIT
*/
'use strict'
var KEY = /^[a-zA-Z$_][a-zA-Z$_0-9]*$/
/**
* handle references
* @constructor
* @param {Object} references
*/
function Ref (references) {
this.keys = []
this.refs = []
this.key = []
this.references = references || []
}
/**
* wrap an object key
* @api private
* @param {String} key - objects key
* @return {String} wrapped key in quotes if necessary
*/
Ref.wrapkey = function (key) {
return (KEY.test(key) ? key : '"' + key.replace(/"/g, '\\"') + '"')
}
Ref.prototype = {
/**
* push `key` to interal array
* @param {String} key
*/
push: function (key) {
this.key.push(key)
},
/**
* remove the last key from internal array
*/
pop: function () {
this.key.pop()
},
/**
* join the keys
*/
join: function (key) {
var out = ''
key = key || this.key
if (typeof key === 'string') {
key = [key]
}
key.forEach(function (k) {
if (KEY.test(k)) {
out += '.' + k
} else {
out += '[' + Ref.wrapkey(k) + ']'
}
})
return out
},
/**
* check if object `source` has an already known reference.
* If so then origin and source are stored in `opts.reference`
* @param {Object} source - object to compare
* @return {Boolean}
*/
hasReference: function (source) {
var idx
if (~(idx = this.refs.indexOf(source))) {
this.references.push([this.join(), this.keys[idx]])
return true
} else {
this.refs.push(source)
this.keys.push(this.join())
}
},
/**
* get the references array
* @return {Array} references array
*/
getReferences: function () {
return this.references
}
}
module.exports = Ref

View file

@ -0,0 +1,109 @@
/* eslint
no-new-func: 0
*/
'use strict'
var UNSAFE_CHARS_REGEXP = /[\\\r\n\t<>\u2028\u2029"/]/g
var CHARS_REGEXP = /[\\\r\n\t"]/g
var UNICODE_CHARS = {
'"': '\\"',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
'\\': '\\\\',
'<': '\\u003C',
'>': '\\u003E',
'/': '\\u002F',
'\u2028': '\\u2028',
'\u2029': '\\u2029'
}
function safeString (str) {
str = str.replace(UNSAFE_CHARS_REGEXP, function (unsafeChar) {
return UNICODE_CHARS[unsafeChar]
})
return str
}
exports.safeString = safeString
function unsafeString (str) {
str = str.replace(CHARS_REGEXP, function (unsafeChar) {
return UNICODE_CHARS[unsafeChar]
})
return str
}
exports.unsafeString = unsafeString
var isArray = exports.isArray = Array.isArray
exports.isArray = isArray
function isString (arg) {
return typeof arg === 'string'
}
exports.isString = isString
function isNull (arg) {
return arg === null
}
exports.isNull = isNull
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 isBuffer (arg) {
return arg instanceof Buffer
}
exports.isBuffer = isBuffer
var TYPED_ARRAYS = [
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
]
function isTypedArray (arg) {
var type = toType(arg)
if (TYPED_ARRAYS.indexOf(type) !== -1) {
return type
}
}
exports.isTypedArray = isTypedArray
function objectToString (o) {
return Object.prototype.toString.call(o)
}
function toType (o) {
return objectToString(o).replace(/^\[object (.*)\]$/, '$1')
}

128
VISUALIZACION/node_modules/serialize-to-js/lib/serialize.js generated vendored Executable file
View file

@ -0,0 +1,128 @@
/*
* @copyright 2016- commenthol
* @license MIT
*/
'use strict'
// dependencies
var util = require('./internal/utils')
var Ref = require('./internal/reference')
/**
* serializes an object to javascript
*
* @example <caption>serializing regex, date, buffer, ...</caption>
* var serialize = require('serialize-to-js').serialize;
* var obj = {
* str: '<script>var a = 0 > 1</script>',
* num: 3.1415,
* bool: true,
* nil: null,
* undef: undefined,
* obj: { foo: 'bar' },
* arr: [1, '2'],
* regexp: /^test?$/,
* date: new Date(),
* buffer: new Buffer('data'),
* }
* console.log(serialize(obj))
* // > {str: "\u003Cscript\u003Evar a = 0 \u003E 1\u003C\u002Fscript\u003E", num: 3.1415, bool: true, nil: null, undef: undefined, obj: {foo: "bar"}, arr: [1, "2"], regexp: /^test?$/, date: new Date("2016-04-15T16:22:52.009Z"), buffer: new Buffer('ZGF0YQ==', 'base64')}
*
* @example <caption>serializing while respecting references</caption>
* var serialize = require('serialize-to-js').serialize;
* var obj = { object: { regexp: /^test?$/ } };
* obj.reference = obj.object;
* var opts = { reference: true };
* console.log(serialize(obj, opts));
* //> {object: {regexp: /^test?$/}}
* console.log(opts.references);
* //> [ [ '.reference', '.object' ] ]
*
* @param {Object|Array|Function|Any} source - source to serialize
* @param {Object} [opts] - options
* @param {Boolean} opts.ignoreCircular - ignore circular objects
* @param {Boolean} opts.reference - reference instead of a copy (requires post-processing of opts.references)
* @param {Boolean} opts.unsafe - do not escape chars `<>/`
* @return {String} serialized representation of `source`
*/
function serialize (source, opts) {
var out = ''
var key
var tmp
var type
var i
opts = opts || {}
if (!opts._visited) {
opts._visited = []
}
if (!opts._refs) {
opts.references = []
opts._refs = new Ref(opts.references)
}
if (util.isNull(source)) {
out += 'null'
} else if (util.isArray(source)) {
tmp = source.map(function (item) {
return serialize(item, opts)
})
out += '[' + tmp.join(', ') + ']'
} else if (util.isFunction(source)) {
out += source.toString()
} else if (util.isObject(source)) {
if (util.isRegExp(source)) {
out += source.toString()
} else if (util.isDate(source)) {
out += 'new Date("' + source.toJSON() + '")'
} else if (util.isError(source)) {
out += 'new Error(' + (source.message ? '"' + source.message + '"' : '') + ')'
} else if (util.isBuffer(source)) {
// check for buffer first otherwise tests fail on node@4.4
// looks like buffers are accidentially detected as typed arrays
out += "Buffer.from('" + source.toString('base64') + "', 'base64')"
} else if ((type = util.isTypedArray(source))) {
tmp = []
for (i = 0; i < source.length; i++) {
tmp.push(source[i])
}
out += 'new ' + type + '(' +
'[' + tmp.join(', ') + ']' +
')'
} else {
tmp = []
// copy properties if not circular
if (!~opts._visited.indexOf(source)) {
opts._visited.push(source)
for (key in source) {
if (source.hasOwnProperty(key)) {
if (opts.reference && util.isObject(source[key])) {
opts._refs.push(key)
if (!opts._refs.hasReference(source[key])) {
tmp.push(Ref.wrapkey(key) + ': ' + serialize(source[key], opts))
}
opts._refs.pop()
} else {
tmp.push(Ref.wrapkey(key) + ': ' + serialize(source[key], opts))
}
}
}
out += '{' + tmp.join(', ') + '}'
opts._visited.pop()
} else {
if (opts.ignoreCircular) {
out += '{/*[Circular]*/}'
} else {
throw new Error('can not convert circular structures.')
}
}
}
} else if (util.isString(source)) {
out += '"' + (opts.unsafe ? util.unsafeString(source) : util.safeString(source)) + '"'
} else {
out += '' + source
}
return out
}
module.exports = serialize

View file

@ -0,0 +1,66 @@
/*
* @copyright 2016- commenthol
* @license MIT
*/
'use strict'
// dependencies
var serialize = require('./serialize')
/**
* serialize to a module which can be `require`ed.
*
* @example <caption>serializing while respecting references</caption>
* var serialTM = require('serialize-to-js').serializeToModule;
* var obj = { object: { regexp: /^test?$/ } };
* obj.reference = obj.object;
* console.log(serialTM(obj, { reference: true }));
* //> var m = module.exports = {
* //> object: {
* //> regexp: /^test?$/
* //> }
* //> }
* //> m.reference = m.object
*
* @param {Object|Array|Function|Any} source - source to serialize
* @param {Object} [opts] - options
* @param {Boolean} opts.ignoreCircular - ignore circular objects
* @param {Boolean} opts.reference - reference instead of a copy (requires post-processing of opts.references)
* @param {Boolean} opts.comment - add a comments - useful for linting tools e.g. using 'eslint-disable'
* @param {Boolean|Object} opts.beautify - beautify output - default is `false`. If Object then use je-beautify options.
* @param {Boolean} opts.unsafe - do not escape chars `<>/`
* @return {String} serialized representation of `source` as module
*/
function serializeToModule (source, opts) {
opts = opts || {}
var out = ''
if (opts.reference) {
opts.references = []
}
if (opts.comment) {
out = '/* ' + opts.comment + ' */\n'
}
out += (opts.references ? 'var m = ' : '') +
'module.exports = ' +
serialize(source, opts) +
';\n'
if (opts.references) {
opts.references.forEach(function (i) {
out += 'm' + i[0] + ' = m' + i[1] + ';\n'
})
}
if (opts.beautify !== false) {
var beautify = require('js-beautify').js_beautify
if (typeof opts.beautify !== 'object') {
opts.beautify = {
indent_size: 2,
indent_char: ' '
}
}
out = beautify(out, opts.beautify)
}
return out
}
module.exports = serializeToModule

64
VISUALIZACION/node_modules/serialize-to-js/package.json generated vendored Executable file
View file

@ -0,0 +1,64 @@
{
"name": "serialize-to-js",
"version": "1.2.2",
"description": "serialize objects to javascript",
"keywords": [
"javascript",
"objects",
"serialize"
],
"homepage": "https://github.com/commenthol/serialize-to-js",
"bugs": {
"url": "https://github.com/commenthol/serialize-to-js/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/commenthol/serialize-to-js.git"
},
"license": "MIT",
"author": "commenthol <commenthol@gmail.com>",
"main": "lib",
"directories": {
"doc": "doc",
"test": "test"
},
"scripts": {
"all": "npm run lint && npm test",
"clean": "rimraf doc coverage .nyc_output node_modules *.tgz",
"coverage": "nyc -r text -r html npm test",
"doc": "jsdox -o doc lib/*.js",
"lint": "eslint '**/*.js'",
"prepublishOnly": "npm run all",
"readme": "markedpp --githubid -i README.md -o README.md",
"test": "mocha"
},
"eslintConfig": {
"extends": "standard",
"plugins": [
"standard"
],
"rules": {
"key-spacing": 0
}
},
"dependencies": {
"js-beautify": "^1.8.9",
"safer-eval": "^1.3.0"
},
"devDependencies": {
"eslint": "^5.11.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"jsdox": "^0.4.10",
"mocha": "^5.2.0",
"nyc": "^13.1.0",
"rimraf": "^2.6.2"
},
"engines": {
"node": ">=4.0.0"
},
"maintainers": "commenthol <commenthol@gmail.com>"
}