
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@lightbase/utils
Advanced tools
Various utilities, some lodash like, some to aid with strict TypeScript. Also includes various type utilities.
Various utilities, some lodash like, some to aid with strict TypeScript. Also includes various type utilities.
This library exports the utility functions in the following groups:
Type-narrowing assertions, that throw when the provided value is falsy. This uses TypeScript assert operator.
assertIsNilAsserts that the provided value is null or undefined. Else throws the provided error.
assertNotNilAsserts that the provided value is not null or `undefined. Else throws the provided
error.
Type-narrowing functions, returning truthy when the value is of the corresponding type. These can be used to constrain type in if-else branches.
isNilReturns true when the provided value is null or undefined.
isRecordReturns true when the provided value is an object-like.
isRecordWithReturns true when the provided value is an object-like and has the provided keys.
Generic assertion functions that don't type-narrow. Can be used to create business-specific validation functions to align business logic and related error return types.
[!INFO]
If at some point TypeScript supports creating assertion functions via a generic function, without manually typing the resulting assertion, this system will be applied to asserts as well.
createInvariantCreate an invariant function to execute business rules. Various options are supported:
This library exports the following utility types:
PrettifyForce TypeScript to resolve the result of computed types. Can be used to improve the readability in Quick-documentation popups and errors.
MaybePromise and MaybeArrayRepresent a value which may be wrapped in a Promise or Array respectively.
ExtractPromise and ExtractArrayExtract the type wrapped in a MaybePromise or MaybeArray respectively.
BrandBrand types, so a general type like string is not assignable to a business constrainted type like 'email' without going through an explicit cast. See the Zod docs or the Total TypeScript article on this subject.
PickKeysThatExtends and OmitKeysThatExtendLike Pick and Omit, but instead of specifying keys, specify the type of value that
should be picked or omitted.
UnionToIntersectionMap union types to an intersection type.
InferFunctionLikeParametersExtract the parameter types from class constructors or functions.
This package has a specific @encapsula/util/node export providing the following
utilities
createAsyncLocalStorageWrapper around
AsyncLocalStorage,
for read-only AsyncLocalStorage use. The main difference is the explicit get and
getOptional functions that wrap AsyncLocalStorage#getStore. get, throws an error
when not in the async-context of a store.
FAQs
Various utilities, some lodash like, some to aid with strict TypeScript. Also includes various type utilities.
We found that @lightbase/utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.