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

@appolo/utils

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appolo/utils - npm Package Compare versions

Comparing version 8.0.34 to 8.0.35

8

lib/functions.js

@@ -68,2 +68,10 @@ "use strict";

}
static toNull(fn) {
try {
return fn();
}
catch (e) {
return null;
}
}
static emptyFn() {

@@ -70,0 +78,0 @@ }

12

lib/functions.ts

@@ -75,3 +75,3 @@ import {Arrays} from "./arrays";

public static to<T, K>(fn: Function): [K, T?] {
public static to<T, K = any>(fn: Function): [K, T?] {
try {

@@ -84,6 +84,14 @@ return [null, fn()]

public static emptyFn(){
public static toNull<T>(fn: Function): T {
try {
return fn()
} catch (e) {
return null
}
}
public static emptyFn() {
}
}

2

lib/objects.ts

@@ -29,3 +29,3 @@ import {Arrays} from "./arrays";

public static isEmpty(obj: { [index: string]: any }): boolean {
public static isEmpty(obj: { [index: string]: any } | any[]): boolean {
return Object.keys(obj || {}).length === 0

@@ -32,0 +32,0 @@ }

@@ -56,2 +56,11 @@ "use strict";

}
static async toNull(promise) {
try {
let result = await promise;
return result;
}
catch (e) {
return null;
}
}
static allSettled(promises) {

@@ -58,0 +67,0 @@ let settled = [];

@@ -66,3 +66,13 @@ import {Deferred} from "./deferred";

public static async toNull<T>(promise: Promise<T>): Promise<T> {
try {
let result = await promise;
return result
} catch (e) {
return null;
}
}
public static allSettled<T>(promises: Promise<T>[]): Promise<({ status: "fulfilled"; value: T; } | { status: "rejected"; reason: any; })[]> {

@@ -69,0 +79,0 @@

@@ -20,3 +20,3 @@ {

"main": "./index.js",
"version": "8.0.34",
"version": "8.0.35",
"license": "MIT",

@@ -34,12 +34,12 @@ "repository": {

"@types/benchmark": "^2.1.1",
"@types/chai": "^4.2.22",
"@types/lodash": "^4.14.175",
"@types/mocha": "^9.0.0",
"@types/node": "^16.10.3",
"@types/chai": "^4.3.0",
"@types/lodash": "^4.14.179",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.21",
"benchmark": "^2.1.4",
"chai": "^4.3.4",
"mocha": "^9.1.2",
"chai": "^4.3.6",
"mocha": "^9.2.1",
"tslib": "^2.3.1",
"typescript": "^4.4.3"
"typescript": "^4.6.2"
}
}

Sorry, the diff of this file is not supported yet

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