@rimbu/base 0.11.0 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
1
  /**
2
2
  * Matches any type of function
3
3
  */
4
- export declare type AnyFunc = (...args: any[]) => any;
4
+ export type AnyFunc = (...args: any[]) => any;
5
5
  /**
6
6
  * Gives true if the given type T is a function, false otherwise.
7
7
  * @typeparam T - the input type
8
8
  */
9
- export declare type IsAnyFunc<T> = AnyFunc extends T ? true : false;
9
+ export type IsAnyFunc<T> = AnyFunc extends T ? true : false;
10
10
  /**
11
11
  * A predicate type for any record that resolves to true if any of the record
12
12
  * properties is a function, false otherwise.
13
13
  * This is useful to have a coarse discrimination between pure data objects and class instances.
14
14
  * @typeparam T - the input type
15
15
  */
16
- export declare type IsObjWithoutFunctions<T> = AnyFunc extends T[keyof T] ? false : true;
16
+ export type IsObjWithoutFunctions<T> = AnyFunc extends T[keyof T] ? false : true;
17
17
  /**
18
18
  * A predicate type that resolves to true if the given type satisfies:
19
19
  * - it is an object type (not a primitive)
@@ -23,28 +23,28 @@ export declare type IsObjWithoutFunctions<T> = AnyFunc extends T[keyof T] ? fals
23
23
  * Otherwise, it resolves to false
24
24
  * @typeparam T - the input type
25
25
  */
26
- export declare type IsPlainObj<T> = T extends null | undefined | number | string | boolean | bigint | symbol | AnyFunc | Iterable<any> | AsyncIterable<any> ? false : IsObjWithoutFunctions<T>;
26
+ export type IsPlainObj<T> = T extends null | undefined | number | string | boolean | bigint | symbol | AnyFunc | Iterable<any> | AsyncIterable<any> ? false : IsObjWithoutFunctions<T>;
27
27
  /**
28
28
  * Utility type that will only accept objects that are considered 'plain objects' according
29
29
  * to the `IsPlainObj` predicate type.
30
30
  * @typeparam T - the value type to test
31
31
  */
32
- export declare type PlainObj<T> = IsPlainObj<T> extends true ? T : never;
32
+ export type PlainObj<T> = IsPlainObj<T> extends true ? T : never;
33
33
  /**
34
34
  * Utility type that will only return true if the input type T is equal to `any`.
35
35
  * @typeparam T - the value type to test
36
36
  */
37
- export declare type IsAny<T> = 0 extends 1 & T ? true : false;
37
+ export type IsAny<T> = 0 extends 1 & T ? true : false;
38
38
  /**
39
39
  * Utility type that will only return true if the input type T is a (readonly) array.
40
40
  * @typeparm T - the value type to test
41
41
  */
42
- export declare type IsArray<T> = T extends readonly any[] ? true : false;
42
+ export type IsArray<T> = T extends readonly any[] ? true : false;
43
43
  /**
44
44
  * Utility type to exclude any types that are iterable. Useful in cases where
45
45
  * plain objects are required as inputs but not arrays.
46
46
  */
47
- export declare type NotIterable = {
47
+ export type NotIterable = {
48
48
  [Symbol.iterator]?: never;
49
49
  };
50
50
  /**
@@ -54,7 +54,7 @@ export declare type NotIterable = {
54
54
  * @returns true if the given object is a pure data object
55
55
  * @note does not check whether a record's properties are not functions
56
56
  */
57
- export declare function isPlainObj(obj: any): boolean;
57
+ export declare function isPlainObj(obj: any): obj is object;
58
58
  /**
59
59
  * Returns true if the given object is Iterable
60
60
  * @param obj - the object to check
@@ -1,2 +1,2 @@
1
1
  export declare const Token: unique symbol;
2
- export declare type Token = typeof Token;
2
+ export type Token = typeof Token;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimbu/base",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Utilities to implement Rimbu collections",
5
5
  "keywords": [
6
6
  "array",
@@ -26,10 +26,19 @@
26
26
  "url": "https://github.com/rimbu-org/rimbu.git",
27
27
  "directory": "packages/base"
28
28
  },
29
- "source": "src/index.ts",
30
- "main": "dist/main/index.js",
31
- "module": "dist/module/index.js",
32
- "types": "dist/types/index.d.ts",
29
+ "source": "./src/index.ts",
30
+ "main": "./dist/main/index.js",
31
+ "module": "./dist/module/index.js",
32
+ "types": "./dist/types/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/types/index.d.ts",
36
+ "import": "./dist/module/index.js",
37
+ "require": "./dist/main/index.js",
38
+ "bun": "./src/index.ts",
39
+ "default": "./dist/module/index.js"
40
+ }
41
+ },
33
42
  "files": [
34
43
  "dist",
35
44
  "src"
@@ -52,11 +61,11 @@
52
61
  },
53
62
  "sideEffects": false,
54
63
  "dependencies": {
55
- "@rimbu/common": "^0.12.0",
56
- "tslib": "^2.4.0"
64
+ "@rimbu/common": "^0.12.2",
65
+ "tslib": "^2.5.0"
57
66
  },
58
67
  "publishConfig": {
59
68
  "access": "public"
60
69
  },
61
- "gitHead": "442ffd299583458d458e9bbe3dd02c67828707f3"
70
+ "gitHead": "4ffac464a67030c80e35241766098837498426e6"
62
71
  }
@@ -76,7 +76,7 @@ export type NotIterable = {
76
76
  * @returns true if the given object is a pure data object
77
77
  * @note does not check whether a record's properties are not functions
78
78
  */
79
- export function isPlainObj(obj: any): boolean {
79
+ export function isPlainObj(obj: any): obj is object {
80
80
  return (
81
81
  typeof obj === 'object' &&
82
82
  null !== obj &&