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

@simplism/core

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simplism/core - npm Package Compare versions

Comparing version 10.3.72 to 10.3.73

2

dist/util/optional.d.ts

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

export declare function optional<T, R>(obj: T, fn: (o: NonNullable<T>) => R): R | undefined;
export declare function optional<R extends any>(fn: () => R): R | undefined;
{
"name": "@simplism/core",
"version": "10.3.72",
"version": "10.3.73",
"description": "Simplism Core Package",

@@ -5,0 +5,0 @@ "repository": "github:kslhunter/simplism",

@@ -1,9 +0,19 @@

/*export type ChainedRequired<T> = { [P in keyof T]-?: ChainedRequired<T[P]> };*/
export function optional<T, R>(obj: T, fn: (o: NonNullable<T>/*ChainedRequired<NonNullable<T>>*/) => R): R | undefined {
export function optional<R extends any>(fn: () => R): R | undefined {
try {
return fn(obj as any);
const result = fn();
if (result instanceof Promise) {
return result
.catch((err: Error) => {
if (err instanceof TypeError && err.message.includes("Cannot read property") && (err.message.includes("of undefined") || err.message.includes("of null"))) {
return;
}
throw err;
});
}
else {
return result;
}
}
catch (err) {
if (err instanceof TypeError && err.message.includes("Cannot read property") && err.message.includes("of undefined")) {
if (err instanceof TypeError && err.message.includes("Cannot read property") && (err.message.includes("of undefined") || err.message.includes("of null"))) {
return undefined;

@@ -13,11 +23,2 @@ }

}
/*const parsed: ILambdaParseResult = LambdaParser.parse(fn);
const chains: string[] = parsed.returnContent.slice(parsed.params[0].length + 1).split(".");
let cursor: any = obj;
for (const chain of chains) {
cursor = cursor === undefined ? undefined : cursor[chain];
}
return cursor;*/
}

Sorry, the diff of this file is too big to display

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