Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tscommons-core

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tscommons-core - npm Package Compare versions

Comparing version 1.21.3 to 1.22.0

dist/types/tarray-with-errors.d.ts

3

dist/helpers/commons-array.d.ts

@@ -0,1 +1,2 @@

import { TArrayWithErrors } from '../types/tarray-with-errors';
export declare abstract class CommonsArray {

@@ -15,2 +16,4 @@ static remove<T>(array: T[], item: T): boolean;

static shuffle<T>(array: T[], minDistance?: number): boolean;
static splitMapErrors<T>(array: (T | Error)[]): TArrayWithErrors<T>;
static mapWithErrors<S, D>(src: S[], callback: (item: S) => D | Error): TArrayWithErrors<D>;
}

@@ -186,4 +186,42 @@ "use strict";

}
static splitMapErrors(array) {
const errors = [];
const items = [];
for (const item of array) {
try {
if (item instanceof Error) {
errors.push(item);
continue;
}
}
catch (e) {
// ignore, probably a Javascript dislike of (e ! class object) instanceof Error
}
items.push(item);
}
return {
errors: errors,
array: items
};
}
static mapWithErrors(src, callback) {
const results = [];
for (const item of src) {
try {
const result = callback(item);
results.push(result);
}
catch (e) {
if (commons_type_1.CommonsType.isError(e)) {
results.push(e);
}
else {
results.push(new Error(e));
}
}
}
return CommonsArray.splitMapErrors(results);
}
}
exports.CommonsArray = CommonsArray;
//# sourceMappingURL=commons-array.js.map

@@ -0,1 +1,2 @@

export * from './tarray-with-errors';
export * from './tdate-range';

@@ -2,0 +3,0 @@ export * from './tdefined';

2

package.json
{
"name": "tscommons-core",
"version": "1.21.3",
"version": "1.22.0",
"description": "",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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