New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typhonjs-escomplex-commons

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typhonjs-escomplex-commons - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

43

dist/module/traits/HalsteadArray.js

@@ -78,3 +78,3 @@ 'use strict';

*
* @returns {*}
* @returns {TraitHalstead}
*/

@@ -103,4 +103,5 @@

* @param {ModuleReport} report - The ModuleReport being processed.
* @param {object} node - Current AST node.
* @param {object} parent - Parent AST node.
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function.
* Normally `params` should be the `current AST node, parent AST node, ... optional
* data`.
*/

@@ -110,9 +111,10 @@ value: function process(report) {

var node = arguments.length <= 1 || arguments[1] === undefined ? undefined : arguments[1];
var parent = arguments.length <= 2 || arguments[2] === undefined ? undefined : arguments[2];
for (var _len = arguments.length, params = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
params[_key - 1] = arguments[_key];
}
this._data.forEach(function (traitHalstead) {
var identifier = traitHalstead.valueOf(node, parent);
var identifier = traitHalstead.valueOf.apply(traitHalstead, params);
if (typeof identifier !== 'undefined' && traitHalstead.filter(node, parent)) {
if (typeof identifier !== 'undefined' && traitHalstead.filter.apply(traitHalstead, params)) {
// Handle the case when a halstead trait element is an array of identifiers.

@@ -129,3 +131,30 @@ if (Array.isArray(identifier)) {

}
/**
* Returns an array of evaluated TraitHalstead data as the value of the `identifier` field of the wrapped data.
* Additionally the TraitHalstead filter function is invoked with the given parameters removing any values that
* fail the filter test.
*
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function. Normally
* `params` should be the `current AST node, parent AST node, ... optional data`.
*
* @returns {Array<*>}
*/
}, {
key: 'valueOf',
value: function valueOf() {
for (var _len2 = arguments.length, params = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
params[_key2] = arguments[_key2];
}
var filtered = this._data.filter(function (traitHalstead) {
return traitHalstead.filter.apply(traitHalstead, params);
});
return filtered.map(function (traitHalstead) {
return traitHalstead.valueOf.apply(traitHalstead, params);
});
}
}, {
key: 'length',

@@ -132,0 +161,0 @@ get: function get() {

3

dist/module/traits/Trait.js

@@ -51,3 +51,4 @@ 'use strict';

*
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function.
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function. Normally
* `params` should be the `current AST node, parent AST node, ... optional data`.
*

@@ -54,0 +55,0 @@ * @returns {*}

@@ -65,3 +65,4 @@ 'use strict';

*
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function.
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function. Normally
* `params` should be the `current AST node, parent AST node, ... optional data`.
*

@@ -68,0 +69,0 @@ * @returns {boolean}

{
"name": "typhonjs-escomplex-commons",
"version": "0.0.3",
"version": "0.0.4",
"homepage": "https://github.com/typhonjs-node-escomplex/typhonjs-escomplex-commons/",

@@ -5,0 +5,0 @@ "description": "Provides core common utilities for typhonjs-escomplex modules and plugins.",

@@ -59,3 +59,3 @@ 'use strict';

*
* @returns {*}
* @returns {TraitHalstead}
*/

@@ -86,12 +86,13 @@ get(index)

* @param {ModuleReport} report - The ModuleReport being processed.
* @param {object} node - Current AST node.
* @param {object} parent - Parent AST node.
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function.
* Normally `params` should be the `current AST node, parent AST node, ... optional
* data`.
*/
process(report, node = undefined, parent = undefined)
process(report, ...params)
{
this._data.forEach((traitHalstead) =>
{
const identifier = traitHalstead.valueOf(node, parent);
const identifier = traitHalstead.valueOf(...params);
if (typeof identifier !== 'undefined' && traitHalstead.filter(node, parent))
if (typeof identifier !== 'undefined' && traitHalstead.filter(...params))
{

@@ -110,2 +111,19 @@ // Handle the case when a halstead trait element is an array of identifiers.

}
/**
* Returns an array of evaluated TraitHalstead data as the value of the `identifier` field of the wrapped data.
* Additionally the TraitHalstead filter function is invoked with the given parameters removing any values that
* fail the filter test.
*
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function. Normally
* `params` should be the `current AST node, parent AST node, ... optional data`.
*
* @returns {Array<*>}
*/
valueOf(...params)
{
const filtered = this._data.filter((traitHalstead) => { return traitHalstead.filter(...params); });
return filtered.map((traitHalstead) => { return traitHalstead.valueOf(...params); });
}
}

@@ -35,3 +35,4 @@ 'use strict';

*
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function.
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function. Normally
* `params` should be the `current AST node, parent AST node, ... optional data`.
*

@@ -38,0 +39,0 @@ * @returns {*}

@@ -59,3 +59,4 @@ 'use strict';

*
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function.
* @param {*} params - Provides parameters which are forwarded onto any data stored as a function. Normally
* `params` should be the `current AST node, parent AST node, ... optional data`.
*

@@ -62,0 +63,0 @@ * @returns {boolean}

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc