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

@saberhq/solana-contrib

Package Overview
Dependencies
Maintainers
2
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saberhq/solana-contrib - npm Package Compare versions

Comparing version 1.12.70 to 1.12.71

13

dist/cjs/utils/misc.d.ts

@@ -34,2 +34,15 @@ /**

export declare const exists: <TValue>(value: TValue | null | undefined) => value is TValue;
/**
* Applies a function to a null/undefined inner value if it is null or undefined,
* otherwise returns null/undefined.
*
* @param obj
* @param fn
* @returns
*/
export declare const mapSome: <T, U>(obj: NonNullable<T> | null | undefined, fn: (obj: NonNullable<T>) => U) => U | null | undefined;
/**
* Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.
*/
export declare const mapN: <T extends unknown[], U>(fn: (...a: { [K in keyof T]: NonNullable<T[K]>; }) => U, ...args: T) => U | null | undefined;
//# sourceMappingURL=misc.d.ts.map

25

dist/cjs/utils/misc.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.exists = exports.isNotUndefined = exports.isNotNull = exports.suppressConsoleError = exports.suppressConsoleErrorAsync = void 0;
exports.mapN = exports.mapSome = exports.exists = exports.isNotUndefined = exports.isNotNull = exports.suppressConsoleError = exports.suppressConsoleErrorAsync = void 0;
const noop = () => {

@@ -75,2 +75,25 @@ // noop

exports.exists = exists;
/**
* Applies a function to a null/undefined inner value if it is null or undefined,
* otherwise returns null/undefined.
*
* @param obj
* @param fn
* @returns
*/
const mapSome = (obj, fn) => ((0, exports.exists)(obj) ? fn(obj) : obj);
exports.mapSome = mapSome;
/**
* Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.
*/
const mapN = (fn, ...args) => {
if (!args.every((arg) => arg !== undefined)) {
return undefined;
}
if (!args.every((arg) => arg !== null)) {
return null;
}
return fn(...args);
};
exports.mapN = mapN;
//# sourceMappingURL=misc.js.map

@@ -34,2 +34,15 @@ /**

export declare const exists: <TValue>(value: TValue | null | undefined) => value is TValue;
/**
* Applies a function to a null/undefined inner value if it is null or undefined,
* otherwise returns null/undefined.
*
* @param obj
* @param fn
* @returns
*/
export declare const mapSome: <T, U>(obj: NonNullable<T> | null | undefined, fn: (obj: NonNullable<T>) => U) => U | null | undefined;
/**
* Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.
*/
export declare const mapN: <T extends unknown[], U>(fn: (...a: { [K in keyof T]: NonNullable<T[K]>; }) => U, ...args: T) => U | null | undefined;
//# sourceMappingURL=misc.d.ts.map

@@ -67,2 +67,23 @@ const noop = () => {

};
/**
* Applies a function to a null/undefined inner value if it is null or undefined,
* otherwise returns null/undefined.
*
* @param obj
* @param fn
* @returns
*/
export const mapSome = (obj, fn) => (exists(obj) ? fn(obj) : obj);
/**
* Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.
*/
export const mapN = (fn, ...args) => {
if (!args.every((arg) => arg !== undefined)) {
return undefined;
}
if (!args.every((arg) => arg !== null)) {
return null;
}
return fn(...args);
};
//# sourceMappingURL=misc.js.map

4

package.json
{
"name": "@saberhq/solana-contrib",
"version": "1.12.70",
"version": "1.12.71",
"description": "Common types and libraries for Solana",

@@ -46,3 +46,3 @@ "author": "Ian Macalinao <ian@saber.so>",

},
"gitHead": "576566ae9814f24e994ac19e2aaa522ebf98f099",
"gitHead": "e735e4e65e0f04a2d1f1950deddffeffa90ea04a",
"publishConfig": {

@@ -49,0 +49,0 @@ "access": "public"

@@ -76,1 +76,38 @@ const noop = () => {

};
/**
* Applies a function to a null/undefined inner value if it is null or undefined,
* otherwise returns null/undefined.
*
* @param obj
* @param fn
* @returns
*/
export const mapSome = <T, U>(
obj: NonNullable<T> | null | undefined,
fn: (obj: NonNullable<T>) => U
): U | null | undefined => (exists(obj) ? fn(obj) : obj);
/**
* Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.
*/
export const mapN = <T extends unknown[], U>(
fn: (
...a: {
[K in keyof T]: NonNullable<T[K]>;
}
) => U,
...args: T
): U | null | undefined => {
if (!args.every((arg) => arg !== undefined)) {
return undefined;
}
if (!args.every((arg) => arg !== null)) {
return null;
}
return fn(
...(args as {
[K in keyof T]: NonNullable<T[K]>;
})
);
};

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

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