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

@saberhq/option-utils

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saberhq/option-utils - npm Package Compare versions

Comparing version 1.14.11 to 1.15.0

2

dist/cjs/index.d.ts

@@ -8,3 +8,3 @@ /**

*/
export declare type Maybe<T> = T | null | undefined;
export type Maybe<T> = T | null | undefined;
/**

@@ -11,0 +11,0 @@ * Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.

@@ -8,3 +8,3 @@ /**

*/
export declare type Maybe<T> = T | null | undefined;
export type Maybe<T> = T | null | undefined;
/**

@@ -11,0 +11,0 @@ * Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.

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

"use strict";
/**

@@ -5,6 +6,8 @@ * [[include:option-utils/README.md]]

*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.exists = exports.isNotUndefined = exports.isNotNull = exports.mapSome = exports.mapN = void 0;
/**
* Applies a function to a list of null/undefined values, unwrapping the null/undefined value or passing it through.
*/
export const mapN = (fn, ...args) => {
const mapN = (fn, ...args) => {
if (!args.every((arg) => arg !== undefined)) {

@@ -18,2 +21,3 @@ return undefined;

};
exports.mapN = mapN;
/**

@@ -30,3 +34,4 @@ * Applies a function to a null/undefined inner value if it is null or undefined,

*/
export const mapSome = (obj, fn) => (exists(obj) ? fn(obj) : obj);
const mapSome = (obj, fn) => ((0, exports.exists)(obj) ? fn(obj) : obj);
exports.mapSome = mapSome;
/**

@@ -40,5 +45,6 @@ * Checks to see if the provided value is not null.

*/
export const isNotNull = (value) => {
const isNotNull = (value) => {
return value !== null;
};
exports.isNotNull = isNotNull;
/**

@@ -50,5 +56,6 @@ * Checks to see if the provided value is not undefined.

*/
export const isNotUndefined = (value) => {
const isNotUndefined = (value) => {
return value !== undefined;
};
exports.isNotUndefined = isNotUndefined;
/**

@@ -60,5 +67,6 @@ * Checks to see if the provided value is not null or undefined.

*/
export const exists = (value) => {
const exists = (value) => {
return value !== null && value !== undefined;
};
exports.exists = exists;
//# sourceMappingURL=index.js.map
{
"name": "@saberhq/option-utils",
"version": "1.14.11",
"version": "1.15.0",
"description": "Utilities for handling optional values in TypeScript.",

@@ -36,8 +36,8 @@ "homepage": "https://github.com/saber-hq/saber-common/tree/master/packages/option-utils#readme",

"dependencies": {
"tslib": "^2.4.0"
"tslib": "^2.6.2"
},
"devDependencies": {
"@saberhq/tsconfig": "^2.1.0",
"typescript": "^4.8.4"
"@saberhq/tsconfig": "^3.1.1",
"typescript": "^5.3.2"
}
}

@@ -31,3 +31,3 @@ /**

[K in keyof T]: NonNullable<T[K]>;
})
}),
);

@@ -49,3 +49,3 @@ };

obj: NonNullable<T> | null | undefined,
fn: (obj: NonNullable<T>) => U
fn: (obj: NonNullable<T>) => U,
): U | null | undefined => (exists(obj) ? fn(obj) : obj);

@@ -72,3 +72,3 @@

export const isNotUndefined = <TValue>(
value: TValue | undefined
value: TValue | undefined,
): value is TValue => {

@@ -85,5 +85,5 @@ return value !== undefined;

export const exists = <TValue>(
value: TValue | null | undefined
value: TValue | null | undefined,
): value is TValue => {
return value !== null && value !== undefined;
};

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

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