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

@nodeswork/utils

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodeswork/utils - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

2

dist/metrics/built-in.operators.d.ts

@@ -5,3 +5,3 @@ import { MetricsValue } from './def';

export declare const COUNT = "count";
export declare function Count(val: number): MetricsValue<number>;
export declare function Count(val?: number): MetricsValue<number>;
export declare const AVERAGE = "avg";

@@ -8,0 +8,0 @@ export declare function Average(val: any, weight?: number): MetricsValue<AverageValue>;

@@ -12,3 +12,3 @@ "use strict";

exports.COUNT = 'count';
function Count(val) {
function Count(val = 1) {
return { oper: exports.COUNT, val, };

@@ -28,2 +28,6 @@ }

};
}, {
default: (v) => v.val.v / v.val.w,
numerator: (v) => v.val.v,
denominator: (v) => v.val.w,
});

@@ -59,3 +63,5 @@ exports.MAX = 'max';

exports.Collect = Collect;
operators_1.operator.registerAggregator(exports.COLLECT, (v1, v2) => v1.concat(v2));
operators_1.operator.registerAggregator(exports.COLLECT, (v1, v2) => v1.concat(v2), {
default: (v) => v.val.length,
});
exports.UNION = 'union';

@@ -66,2 +72,4 @@ function Union(val) {

exports.Union = Union;
operators_1.operator.registerAggregator(exports.UNION, (v1, v2) => _.union(v1, v2));
operators_1.operator.registerAggregator(exports.UNION, (v1, v2) => _.union(v1, v2), {
default: (v) => v.val.length,
});
import { MetricsData, MetricsDimensions, MetricsValue, Operator } from './def';
export declare class MetricsOperator {
private operators;
private valueRetrievers;
constructor();
registerAggregator<T>(operand: string, oper: Operator<T>): void;
registerAggregator<T>(operand: string, oper: Operator<T>, retrievers?: {
[method: string]: (val: MetricsValue<any>) => number;
}): void;
retrieveValue(value: MetricsValue<any>, method?: string): number;
operate<V>(values: MetricsValue<V>[]): MetricsValue<V>;

@@ -7,0 +11,0 @@ updateMetricsData<T>(options: UpdateMetricsDataOptions<T>, target?: MetricsData): MetricsData;

@@ -6,9 +6,17 @@ "use strict";

const utils_1 = require("./utils");
const DEFAULT_VALUE_RETRIVER = {
default: (val) => val.val,
};
class MetricsOperator {
constructor() {
this.operators = {};
this.valueRetrievers = {};
}
registerAggregator(operand, oper) {
registerAggregator(operand, oper, retrievers = DEFAULT_VALUE_RETRIVER) {
this.operators[operand] = oper;
this.valueRetrievers[operand] = retrievers;
}
retrieveValue(value, method = 'default') {
return this.valueRetrievers[value.oper][method](value.val);
}
operate(values) {

@@ -15,0 +23,0 @@ if (values == null) {

{
"name": "@nodeswork/utils",
"version": "0.1.3",
"version": "0.1.4",
"description": "Utilities used across nodeswork repos.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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