Dia antes primera install

This commit is contained in:
2025-12-08 15:20:28 -06:00
commit 1416478c9c
4130 changed files with 886376 additions and 0 deletions

3
node_modules/for-each-property-deep/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules/
_private/
npm-debug*

3
node_modules/for-each-property-deep/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,3 @@
language: node_js
node_js:
- "6"

66
node_modules/for-each-property-deep/README.md generated vendored Normal file
View File

@@ -0,0 +1,66 @@
# for-each-property-deep
[![Build Status](https://api.travis-ci.org/DiegoZoracKy/for-each-property-deep.svg)](https://travis-ci.org/DiegoZoracKy/for-each-property-deep)
Executes a callback for each property found on a object, recursively on nested properties, with options regarding **enumerability** (enumerable or non-enumerable) and **ownership** (inherited or only own properties). It excludes built-in properties from Object and Function prototypes by default, and this behaviour can also be configured via options.
## Goal
The goal is to provide a way to iterate through object's properties with a clean interface regarding **enumerability** and **ownership**, e.g. `{ enumerability: 'enumerable', inherited: true }`. Also, discarding (or not, is an option) the built-in properties that may be found when looking up on the prototype-chain.
This module is the recursive version, which will traverse object's nested properties, of [for-each-property](https://github.com/DiegoZoracKy/for-each-property).
## Usage
```javascript
const forEachPropertyDeep = require('for-each-property-deep');
const object = { a: { b: { c: 'cValue'} } };
const callback = (value, key, path, parent, state) => console.log(key, path);
const options = {enumerability: 'enumerable', inherited: false};
const resultState = forEachPropertyDeep(object, callback, options);
// All outputs (console.log) from callback will be:
// a [ 'a' ]
// b [ 'a', 'b' ]
// c [ 'a', 'b', 'c' ]
```
**object**:
Literal object, Object Instance, Class Reference... Any object whose properties can be iterated on.
**callback**:
Function that will receive `(value, key, path, parent, state)`.
* **value**
Current property value
* **key**
Current property name
* **path**
An array representing the current property path. e.g. from the above example it will be `[ 'a', 'b', 'c' ]` for the `'c'` property
* **parent**
The parent object of the current property. e.g. from the above example it will be the object `{ c: 'cValue' }` for the `'c'` property
* **state**
Is an object that will be stateful throughall iterations, and it will be the value returned by calling `forEachPropertyDeep`. It can be useful to handle any data from within the callback function, instead of relying on external variables. e.g., to store and get all the *paths* found.
**options**:
* **enumerability**:
The options are: `'enumerable'` *(default)*, `'nonenumerable'` or `'all'`
* **inherited**:
The options are: `true` *(default)* or `false`
* **excludeBuiltInPropsOf**:
An array of objects whose prototype properties must be excluded. It defaults to `[Function, Object]`
* **excludeProps**:
An array properties that must be excluded. The default is `['prototype']`
## Example
To check an extended example on use cases regarding **enumerability** and **ownership** check [for-each-property#example](https://github.com/DiegoZoracKy/for-each-property#example).

View File

@@ -0,0 +1,23 @@
'use strict';
const forEachProperty = require('for-each-property');
function forEachPropertyDeep(o, callback, { enumerability = 'enumerable', inherited = false, excludeBuiltInPropsOf = [Function, Object], excludeProps = ['prototype'], parent, state = {}, path = [], objectsInspected = new Map } = {}) {
const forEachPropOptions = { enumerability, inherited, excludeBuiltInPropsOf, excludeProps };
forEachProperty(o, (value, key) => {
let currentPath = path.concat(key);
callback(value, key, currentPath, o, state);
if (value && (typeof(value) === 'function' || typeof(value) === 'object') && !objectsInspected.has(value)) {
objectsInspected.set(value);
forEachPropertyDeep(value, callback, { parent: o, path: currentPath, enumerability, inherited, state, excludeBuiltInPropsOf, excludeProps, objectsInspected });
}
}, forEachPropOptions);
return state;
}
module.exports = forEachPropertyDeep;

44
node_modules/for-each-property-deep/package.json generated vendored Normal file
View File

@@ -0,0 +1,44 @@
{
"name": "for-each-property-deep",
"version": "0.0.3",
"description": "Executes a callback for each property found on a object, recursively on nested properties, with options regarding enumerability (enumerable or non-enumerable) and ownership (inherited or only own properties). It excludes built-in properties from Object and Function prototypes by default, and this behaviour can also be configured via options.",
"main": "lib/for-each-property-deep.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "mocha ./test"
},
"keywords": [
"recursive",
"deep",
"for",
"each",
"prop",
"property",
"object",
"function",
"enumerable",
"non-enumerable",
"nonenumerable",
"inherited",
"proto",
"prototype",
"prototype-chain",
"class",
"static"
],
"author": {
"name": "Diego ZoracKy",
"email": "diego.zoracky@gmail.com",
"url": "https://github.com/DiegoZoracKy/"
},
"license": "MIT",
"dependencies": {
"for-each-property": "0.0.4"
},
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^3.4.2"
}
}

101
node_modules/for-each-property-deep/test/main.test.js generated vendored Normal file
View File

@@ -0,0 +1,101 @@
'use strict';
const assert = require('assert');
const forEachPropertyDeep = require('../');
const testDataSet = require('./test.data.js');
////////////////////////////
// functionWithProperties //
////////////////////////////
testDataSet.forEach(testData => {
describe(testData.name, function() {
describe('keys / props', function() {
describe(`forEachPropertyDeep :: forEachOwnEnumerableProperty :: enumerability: 'enumerable', inherited: false`, function() {
testForEachPropertyDeepKeys(testData.ref, testData.forEachOwnEnumerableProperty.keys, { enumerability: 'enumerable', inherited: false });
});
describe(`forEachPropertyDeep :: forEachOwnNonenumerableProperty :: enumerability: 'nonenumerable', inherited: false`, function() {
testForEachPropertyDeepKeys(testData.ref, testData.forEachOwnNonenumerableProperty.keys, { enumerability: 'nonenumerable', inherited: false });
});
describe(`forEachPropertyDeep :: forEachOwnEnumerableAndNonenumerableProperty :: enumerability: 'all', inherited: false`, function() {
testForEachPropertyDeepKeys(testData.ref, testData.forEachOwnEnumerableAndNonenumerableProperty.keys, { enumerability: 'all', inherited: false });
});
describe(`forEachPropertyDeep :: forEachEnumerableProperty :: enumerability: 'enumerable', inherited: true`, function() {
testForEachPropertyDeepKeys(testData.ref, testData.forEachEnumerableProperty.keys, { enumerability: 'enumerable', inherited: true });
});
describe(`forEachPropertyDeep :: forEachNonenumerableProperty :: enumerability: 'nonenumerable', inherited: true`, function() {
testForEachPropertyDeepKeys(testData.ref, testData.forEachNonenumerableProperty.keys, { enumerability: 'nonenumerable', inherited: true });
});
describe(`forEachPropertyDeep :: forEachEnumerableAndNonenumerableProperty :: enumerability: 'all', inherited: true`, function() {
testForEachPropertyDeepKeys(testData.ref, testData.forEachEnumerableAndNonenumerableProperty.keys, { enumerability: 'all', inherited: true });
});
});
describe('paths', function() {
describe(`forEachPropertyDeep :: forEachOwnEnumerableProperty :: enumerability: 'enumerable', inherited: false`, function() {
testForEachPropertyDeepPaths(testData.ref, testData.forEachOwnEnumerableProperty.paths, { enumerability: 'enumerable', inherited: false });
});
describe(`forEachPropertyDeep :: forEachOwnNonenumerableProperty :: enumerability: 'nonenumerable', inherited: false`, function() {
testForEachPropertyDeepPaths(testData.ref, testData.forEachOwnNonenumerableProperty.paths, { enumerability: 'nonenumerable', inherited: false });
});
describe(`forEachPropertyDeep :: forEachOwnEnumerableAndNonenumerableProperty :: enumerability: 'all', inherited: false`, function() {
testForEachPropertyDeepPaths(testData.ref, testData.forEachOwnEnumerableAndNonenumerableProperty.paths, { enumerability: 'all', inherited: false });
});
describe(`forEachPropertyDeep :: forEachEnumerableProperty :: enumerability: 'enumerable', inherited: true`, function() {
testForEachPropertyDeepPaths(testData.ref, testData.forEachEnumerableProperty.paths, { enumerability: 'enumerable', inherited: true });
});
describe(`forEachPropertyDeep :: forEachNonenumerableProperty :: enumerability: 'nonenumerable', inherited: true`, function() {
testForEachPropertyDeepPaths(testData.ref, testData.forEachNonenumerableProperty.paths, { enumerability: 'nonenumerable', inherited: true });
});
describe(`forEachPropertyDeep :: forEachEnumerableAndNonenumerableProperty :: enumerability: 'all', inherited: true`, function() {
testForEachPropertyDeepPaths(testData.ref, testData.forEachEnumerableAndNonenumerableProperty.paths, { enumerability: 'all', inherited: true });
});
});
});
});
function testForEachPropertyDeepKeys(ref, propsExpected, options) {
const propsFound = [];
it(`must find the same number of props expected`, function() {
forEachPropertyDeep(ref, (value, key) => {
propsFound.push(key);
}, options);
assert.equal(propsFound.length, propsExpected.length);
});
it(`must find every prop expected`, function() {
assert(propsFound.every(prop => propsExpected.includes(prop)));
});
}
function testForEachPropertyDeepPaths(ref, pathsExpected, options) {
let pathsFound = [];
it(`must find the same number of paths expected`, function() {
forEachPropertyDeep(ref, (v, k, path) => {
pathsFound = pathsFound.concat(path.join('.'));
}, options);
assert.equal(pathsFound.length, pathsExpected.length);
});
it(`must find every path expected`, function() {
assert(pathsFound.every(prop => pathsExpected.includes(prop)));
});
}

355
node_modules/for-each-property-deep/test/test.data.js generated vendored Normal file
View File

@@ -0,0 +1,355 @@
//////////////
// Function //
//////////////
function functionWithProperties() {}
// Function Inner Property
functionWithProperties.functionWithPropertiesEnumerablePropEnumerable = 'functionWithPropertiesEnumerablePropEnumerableVALUE';
Object.defineProperty(functionWithProperties, 'functionWithPropertiesEnumerablePropNonEnumerable', {
configurable: true,
enumerable: false,
writable: true,
value: 'functionWithPropertiesEnumerablePropNonEnumerableVALUE'
});
Object.defineProperty(functionWithProperties.prototype, 'protoEnumerableProp', {
configurable: true,
enumerable: true,
writable: true,
value: 'protoEnumerablePropVALUE'
});
Object.defineProperty(functionWithProperties.prototype, 'protoNonEnumerableProp', {
configurable: true,
enumerable: false,
writable: true,
value: 'nonEnumerablePropVALUE'
});
///////////////////////////////////
// Object Instance from Function //
// Object.defineProperty //
///////////////////////////////////
const instanceFromFunctionWithProperties = new functionWithProperties();
Object.defineProperty(instanceFromFunctionWithProperties, 'propEnumerable', {
configurable: true,
enumerable: true,
writable: true,
value: 'propEnumerableVALUE'
});
Object.defineProperty(instanceFromFunctionWithProperties, 'propNonEnumerable', {
configurable: true,
enumerable: false,
writable: true,
value: 'propNonEnumerableVALUE'
});
////////////////////
// Object Literal //
////////////////////
const fnTest = x => console.log('fnTest!');
fnTest.innerFn = x => console.log('fnTest.innerFn!');
const objectLiteral = {
a: {
b: {
c: x => x
},
d: 'e',
f: {
g: 'h'
}
},
fn: fnTest,
z: {
k: {},
zk: 'ZK',
N: 1984,
de: { ep: 10 },
kz: {
zz: {
kk: function ha() {}
},
k: 'K',
fnR: fnTest
}
}
};
///////////
// CLASS //
///////////
class classRef3 {
constructor() {
this.z = 'classRef3';
}
static classRef3Static() {
console.log('classRef3Static');
}
fffn() {
console.log('classRef3Static fffn');
}
ffn() {
console.log('classRef3Static ffn');
}
}
class classRef2 extends classRef3 {
constructor() {
super();
this.zz = 'classRef2';
this.superFn = {
superInnerFn: x => console.log(`superFn!`)
};
this.superFn.superInnerFn.fnWithProp = x => console.log(`fnWithProp!`);
}
static classRef2Static() {
console.log('classRef2Static');
}
ffn() {
console.log('classRef2Static ffn');
}
}
class classRef extends classRef2 {
constructor() {
super();
this.z = 'classRef';
this.instanceFn = x => console.log(`instanceFn!`);
}
static classRefStatic() {
console.log('classRefStatic');
}
fn() {
console.log('classRefStatic fn');
}
}
////////////////////////////////
// OBJECT INSTANCE FROM CLASS //
////////////////////////////////
const instanceFromClassRef = new classRef();
Object.defineProperty(instanceFromClassRef, 'instanceFnNonEnumerable', {
value: 'instanceFnNonEnumerableVALUE'
});
/////////////////////////////////////////
// OBJECT.CREATE FROM PARENT PROTOTYPE //
/////////////////////////////////////////
const Parent = function() {};
Parent.ParentEnumerableProp = 'ParentEnumerablePropVALUE';
Object.defineProperty(Parent.prototype, 'ParentEnumerablePropt', {
configurable: true,
enumerable: true,
writable: true,
value: 'ParentEnumerableProptVALUE'
});
Object.defineProperty(Parent.prototype, 'ParentNonEnumerableProto', {
configurable: false,
enumerable: false,
writable: false,
value: 'ParentNonEnumerableProtoVALUE'
});
Object.defineProperty(Parent, 'parentNonEnumerableProp', {
configurable: false,
enumerable: false,
writable: false,
value: 'parentNonEnumerablePropVALUE'
});
const objectCreatedWithParentProto = Object.create(Parent, {
ownNonEmurableProp: {
value: 'ownNonEmurablePropVALUE'
},
ownEmurableProp: {
value: 'ownEmurablePropVALUE',
enumerable: true
}
});
objectCreatedWithParentProto.enumerableProp = 'enumerablePropVALUE';
module.exports = [{
name: 'functionWithProperties',
ref: functionWithProperties,
forEachOwnEnumerableProperty: {
keys: ['functionWithPropertiesEnumerablePropEnumerable'],
paths: ['functionWithPropertiesEnumerablePropEnumerable'],
},
forEachOwnNonenumerableProperty: {
keys: ['functionWithPropertiesEnumerablePropNonEnumerable'],
paths: ['functionWithPropertiesEnumerablePropNonEnumerable'],
},
forEachOwnEnumerableAndNonenumerableProperty: {
keys: ['functionWithPropertiesEnumerablePropEnumerable','functionWithPropertiesEnumerablePropNonEnumerable'],
paths: ['functionWithPropertiesEnumerablePropEnumerable', 'functionWithPropertiesEnumerablePropNonEnumerable' ],
},
forEachEnumerableProperty: {
keys: ['functionWithPropertiesEnumerablePropEnumerable'],
paths: ['functionWithPropertiesEnumerablePropEnumerable'],
},
forEachNonenumerableProperty: {
keys: ['functionWithPropertiesEnumerablePropNonEnumerable'],
paths: ['functionWithPropertiesEnumerablePropNonEnumerable'],
},
forEachEnumerableAndNonenumerableProperty: {
keys: ['functionWithPropertiesEnumerablePropEnumerable','functionWithPropertiesEnumerablePropNonEnumerable'],
paths: ['functionWithPropertiesEnumerablePropEnumerable', 'functionWithPropertiesEnumerablePropNonEnumerable'],
}
}, {
name: 'instanceFromFunctionWithProperties',
ref: instanceFromFunctionWithProperties,
forEachOwnEnumerableProperty: {
keys: ['propEnumerable'],
paths: ['propEnumerable'],
},
forEachOwnNonenumerableProperty: {
keys: ['propNonEnumerable'],
paths: ['propNonEnumerable'],
},
forEachOwnEnumerableAndNonenumerableProperty: {
keys: ['propEnumerable','propNonEnumerable'],
paths: ['propEnumerable', 'propNonEnumerable'],
},
forEachEnumerableProperty: {
keys: ['propEnumerable','protoEnumerableProp'],
paths: ['propEnumerable', 'protoEnumerableProp'],
},
forEachNonenumerableProperty: {
keys: ['propNonEnumerable','protoNonEnumerableProp'],
paths: ['propNonEnumerable', 'protoNonEnumerableProp'],
},
forEachEnumerableAndNonenumerableProperty: {
keys: ['propEnumerable','propNonEnumerable','protoEnumerableProp','protoNonEnumerableProp'],
paths: ['propEnumerable', 'propNonEnumerable', 'protoEnumerableProp', 'protoNonEnumerableProp'],
},
}, {
name: 'objectLiteral',
ref: objectLiteral,
forEachOwnEnumerableProperty: {
keys: ['a','b','c','d','f','g','fn','innerFn','z','k','zk','N','de','ep','kz','zz','kk','k','fnR'],
paths: ["a","a.b","a.b.c","a.d","a.f","a.f.g","fn","fn.innerFn","z","z.k","z.zk","z.N","z.de","z.de.ep","z.kz","z.kz.zz","z.kz.zz.kk","z.kz.k","z.kz.fnR"],
},
forEachOwnNonenumerableProperty: {
keys: [],
paths: [],
},
forEachOwnEnumerableAndNonenumerableProperty: {
keys: ['a','b','c','d','f','g','fn','innerFn','z','k','zk','N','de','ep','kz','zz','kk','k','fnR'],
paths: ["a","a.b","a.b.c","a.d","a.f","a.f.g","fn","fn.innerFn","z","z.k","z.zk","z.N","z.de","z.de.ep","z.kz","z.kz.zz","z.kz.zz.kk","z.kz.k","z.kz.fnR"],
},
forEachEnumerableProperty: {
keys: ['a','b','c','d','f','g','fn','innerFn','z','k','zk','N','de','ep','kz','zz','kk','k','fnR'],
paths: ["a","a.b","a.b.c","a.d","a.f","a.f.g","fn","fn.innerFn","z","z.k","z.zk","z.N","z.de","z.de.ep","z.kz","z.kz.zz","z.kz.zz.kk","z.kz.k","z.kz.fnR"],
},
forEachNonenumerableProperty: {
keys: [],
paths: [],
},
forEachEnumerableAndNonenumerableProperty: {
keys: ['a','b','c','d','f','g','fn','innerFn','z','k','zk','N','de','ep','kz','zz','kk','k','fnR'],
paths: ["a","a.b","a.b.c","a.d","a.f","a.f.g","fn","fn.innerFn","z","z.k","z.zk","z.N","z.de","z.de.ep","z.kz","z.kz.zz","z.kz.zz.kk","z.kz.k","z.kz.fnR"]
},
}, {
name: 'classRef',
ref: classRef,
forEachOwnEnumerableProperty: {
keys: [],
paths: [],
},
forEachOwnNonenumerableProperty: {
keys: ['classRefStatic'],
paths: ['classRefStatic'],
},
forEachOwnEnumerableAndNonenumerableProperty: {
keys: ['classRefStatic'],
paths: ['classRefStatic'],
},
forEachEnumerableProperty: {
keys: [],
paths: [],
},
forEachNonenumerableProperty: {
keys: ['classRefStatic','classRef2Static','classRef3Static'],
paths: ['classRefStatic','classRef2Static','classRef3Static'],
},
forEachEnumerableAndNonenumerableProperty: {
keys: ['classRefStatic','classRef2Static','classRef3Static'],
paths: ['classRefStatic','classRef2Static','classRef3Static']
},
}, {
name: 'instanceFromClassRef',
ref: instanceFromClassRef,
forEachOwnEnumerableProperty: {
keys: ['z','zz','superFn','superInnerFn','fnWithProp','instanceFn'],
paths: ["z","zz","superFn","superFn.superInnerFn","superFn.superInnerFn.fnWithProp","instanceFn"]
},
forEachOwnNonenumerableProperty: {
keys: ['instanceFnNonEnumerable'],
paths: ["instanceFnNonEnumerable"]
},
forEachOwnEnumerableAndNonenumerableProperty: {
keys: ['z','zz','superFn','superInnerFn','fnWithProp','instanceFn','instanceFnNonEnumerable'],
paths: ["z","zz","superFn","superFn.superInnerFn","superFn.superInnerFn.fnWithProp","instanceFn","instanceFnNonEnumerable"]
},
forEachEnumerableProperty: {
keys: ['z','zz','superFn','superInnerFn','fnWithProp','instanceFn'],
paths: ["z","zz","superFn","superFn.superInnerFn","superFn.superInnerFn.fnWithProp","instanceFn"]
},
forEachNonenumerableProperty: {
keys: ['instanceFnNonEnumerable','fn','ffn','fffn','ffn'],
paths: ["instanceFnNonEnumerable","fn","ffn","fffn","ffn"]
},
forEachEnumerableAndNonenumerableProperty: {
keys: ['z','zz','superFn','superInnerFn','fnWithProp','instanceFn','instanceFnNonEnumerable','fn','ffn','fffn','ffn'],
paths: ["z","zz","superFn","superFn.superInnerFn","superFn.superInnerFn.fnWithProp","instanceFn","instanceFnNonEnumerable","fn","ffn","fffn","ffn"]
},
}, {
name: 'objectCreatedWithParentProto',
ref: objectCreatedWithParentProto,
forEachOwnEnumerableProperty: {
keys: ['ownEmurableProp','enumerableProp'],
paths: ["ownEmurableProp","enumerableProp"],
},
forEachOwnNonenumerableProperty: {
keys: ['ownNonEmurableProp'],
paths: ["ownNonEmurableProp"],
},
forEachOwnEnumerableAndNonenumerableProperty: {
keys: ['ownNonEmurableProp','ownEmurableProp','enumerableProp'],
paths: ["ownNonEmurableProp","ownEmurableProp","enumerableProp"],
},
forEachEnumerableProperty: {
keys: ['ownEmurableProp','enumerableProp','ParentEnumerableProp'],
paths: ["ownEmurableProp","enumerableProp","ParentEnumerableProp"],
},
forEachNonenumerableProperty: {
keys: ['ownNonEmurableProp','parentNonEnumerableProp'],
paths: ["ownNonEmurableProp","parentNonEnumerableProp"],
},
forEachEnumerableAndNonenumerableProperty: {
keys: ['ownNonEmurableProp','ownEmurableProp','enumerableProp','ParentEnumerableProp','parentNonEnumerableProp'],
paths: ["ownNonEmurableProp","ownEmurableProp","enumerableProp","ParentEnumerableProp","parentNonEnumerableProp"]
},
}];