Socket
Socket
Sign inDemoInstall

@rimbu/base

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rimbu/base - npm Package Compare versions

Comparing version 0.9.5 to 0.10.0

23

dist/types/plain-object.d.ts

@@ -6,7 +6,13 @@ /**

/**
* Gives true if the given type T is a function, false otherwise.
* @typeparam T - the input type
*/
export declare type IsAnyFunc<T> = AnyFunc extends T ? true : false;
/**
* A predicate type for any record that resolves to true if any of the record
* properties is a function, false otherwise.
* This is useful to have a coarse discrimination between pure data objects and class instances.
* @typeparam T - the input type
*/
export declare type IsObjWithoutFunctions<T extends Record<any, any>> = AnyFunc extends T[keyof T] ? false : true;
export declare type IsObjWithoutFunctions<T> = AnyFunc extends T[keyof T] ? false : true;
/**

@@ -19,4 +25,5 @@ * A predicate type that resolves to true if the given type satisfies:

* Otherwise, it resolves to false
* @typeparam T - the input type
*/
export declare type IsPlainObj<T> = T extends null | undefined | number | string | boolean | bigint | symbol | AnyFunc | Iterable<unknown> | AsyncIterable<unknown> ? false : IsObjWithoutFunctions<T>;
export declare type IsPlainObj<T> = T extends null | undefined | number | string | boolean | bigint | symbol | AnyFunc | Iterable<any> | AsyncIterable<any> ? false : IsObjWithoutFunctions<T>;
/**

@@ -34,2 +41,14 @@ * Utility type that will only accept objects that are considered 'plain objects' according

/**
* Utility type that will only return true if the input type T is a (readonly) array.
* @typeparm T - the value type to test
*/
export declare type IsArray<T> = T extends readonly any[] ? true : false;
/**
* Utility type to exclude any types that are iterable. Useful in cases where
* plain objects are required as inputs but not arrays.
*/
export declare type NotIterable = {
[Symbol.iterator]?: never;
};
/**
* Companion function to the `IsRecord<T>` type that checks whether the given object is a pure

@@ -36,0 +55,0 @@ * data object.

5

package.json
{
"name": "@rimbu/base",
"version": "0.9.5",
"version": "0.10.0",
"description": "Utilities to implement Rimbu collections",

@@ -50,2 +50,3 @@ "keywords": [

"test": "jest",
"test:types": "tsd",
"typecheck": "tsc"

@@ -65,3 +66,3 @@ },

},
"gitHead": "c4009664c4e15f367e963d198cacd7c5fc182a4d"
"gitHead": "22ae1cadeb885e7fd30a23bd05c001cda3141e86"
}

@@ -7,8 +7,16 @@ /**

/**
* Gives true if the given type T is a function, false otherwise.
* @typeparam T - the input type
*/
export type IsAnyFunc<T> = AnyFunc extends T ? true : false;
/**
* A predicate type for any record that resolves to true if any of the record
* properties is a function, false otherwise.
* This is useful to have a coarse discrimination between pure data objects and class instances.
* @typeparam T - the input type
*/
export type IsObjWithoutFunctions<T extends Record<any, any>> =
AnyFunc extends T[keyof T] ? false : true;
export type IsObjWithoutFunctions<T> = AnyFunc extends T[keyof T]
? false
: true;

@@ -22,2 +30,3 @@ /**

* Otherwise, it resolves to false
* @typeparam T - the input type
*/

@@ -33,4 +42,4 @@ export type IsPlainObj<T> = T extends

| AnyFunc
| Iterable<unknown>
| AsyncIterable<unknown>
| Iterable<any>
| AsyncIterable<any>
? false

@@ -53,2 +62,16 @@ : IsObjWithoutFunctions<T>;

/**
* Utility type that will only return true if the input type T is a (readonly) array.
* @typeparm T - the value type to test
*/
export type IsArray<T> = T extends readonly any[] ? true : false;
/**
* Utility type to exclude any types that are iterable. Useful in cases where
* plain objects are required as inputs but not arrays.
*/
export type NotIterable = {
[Symbol.iterator]?: never;
};
/**
* Companion function to the `IsRecord<T>` type that checks whether the given object is a pure

@@ -55,0 +78,0 @@ * data object.

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc