atomic-fns 1.1.1 → 1.1.3

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.
package/README.md CHANGED
@@ -1,23 +1,23 @@
1
1
  # atomic-fns
2
2
 
3
- [Read the Docs](https://atomic-fns.dev)
3
+ [Read the Docs](https://atomic-stack.github.io/atomic-fns/)
4
4
 
5
- ## Like Lodash, but in TypeScript and for ESnext.
5
+ ## Like Lodash, but in TypeScript and for ESNext.
6
6
 
7
- Stop shipping code built for browsers from 2015. Really though, look at all the [issues](https://github.com/lodash/lodash/issues/2930).
7
+ Stop shipping code built for browsers from 2015.
8
8
 
9
9
  You may prefer this because it's:
10
10
 
11
11
  * **TypeScript & docs**: Includes type declaration files and js with JSDocs for best in class experience.
12
12
  * **Zero deps**: Built from scratch with no runtime dependencies or polyfills.
13
- * **ESnext**: Uses modern idiomatic syntax, data structures, and control flow techniques.
14
- * **Modular**: Pick what you need. Supports tree-shaking, no side effects and works with all bundlers.
13
+ * **ESNext**: Uses modern idiomatic syntax, data structures, and control flow techniques.
14
+ * **Modular**: Pick what you need. Supports tree-shaking, no side effects, and works with all bundlers.
15
15
  * **Lazy**: Leverage generators, iterators, and functional composition.
16
- * **Well tested**: All modules have comprehensive test suites and public apis are 100% coverage.
16
+ * **Tests**: All modules have comprehensive test suites and public apis are 100% covered.
17
17
 
18
18
  ## Docs
19
19
 
20
- 📖 Available at [atomic-fns.dev](https://atomic-fns.dev)
20
+ 📖 Available at [https://atomic-stack.github.io/atomic-fns/](atomic-stack.github.io/atomic-fns)
21
21
 
22
22
  ## Get Started
23
23
 
@@ -47,12 +47,12 @@ uniqueId('user_')
47
47
  ...
48
48
  ```
49
49
 
50
- See the full list of [modules](https://atomic-fns.dev/modules.html).
50
+ See the full list of [modules](https://atomic-stack.github.io/atomic-fns/modules.html).
51
51
 
52
52
  ## Data model
53
53
  This library features a data model similar to [Python](https://docs.python.org/3/reference/datamodel.html#special-method-names) but not always. Only the missing parts have been implemented, while respecting the JS standards.
54
54
 
55
- For example in Python collections `size()` is a method while in JS its just a property. So this library uses `size` property instead of methods. Similarly, the `len` function implementation checks for both `length` and `size` since many JS objects have a `length` property.
55
+ For example, in Python collections, `size()` is a method, while in JS it's just a property. So this library uses `size` property instead of method. Similarly, the `len` function implementation checks for both `length` and `size` since many JS objects have a `length` property.
56
56
 
57
57
  ## Special method names
58
58
  This library adds support for operators using object methods such as:
@@ -63,21 +63,23 @@ This library adds support for operators using object methods such as:
63
63
  - `obj.gte(other)` adds custom `obj >= other`.
64
64
  - `obj.compare(other)` overloads sorting operations.
65
65
 
66
- When you implement those, you can also apply operators to values like `eq(x, y), lte(x, y), compare(x, y)`, etc. to get the result of `x.<operator>(y)`.
66
+ When working with objects, functions in this library use these custom operators for equality and sorting. You can also apply operators to values like `eq(x, y)`, `lte(x, y)`, `compare(x, y)`, etc.
67
67
 
68
68
  ## New Types
69
69
 
70
- Introduces some common base interfaces and typing patterns you may have seen like `Optional`, `Result`, `Comparable`, `Iterator`, and others.
70
+ [`Decimal`](https://atomic-stack.github.io/atomic-fns/classes/decimal.Decimal.html) provides support for correct rounded floating point arithmetic, with arbitrary precision.
71
+
72
+ Some common base interfaces and typing patterns you may have seen like `Optional`, `Result`, `Comparable`, `Iterator`, and others.
71
73
 
72
74
  ### Sorted Containers
73
- - [SortedSet](https://atomic-fns.dev/classes/Collections.SortedSet.html)
74
- - [SortedMap](https://atomic-fns.dev/classes/Collections.SortedMap.html)
75
- - [SortedTree](https://atomic-fns.dev/classes/Collections.SortedTree.html)
75
+ - [SortedSet](https://atomic-stack.github.io/atomic-fns/classes/collections.SortedSet.html)
76
+ - [SortedMap](https://atomic-stack.github.io/atomic-fns/classes/collections.SortedMap.html)
77
+ - [SortedTree](https://atomic-stack.github.io/atomic-fns/classes/collections.SortedTree.html)
76
78
 
77
79
  ### Other Containers
78
- - [Deque](https://atomic-fns.dev/classes/Collections.Deque.html)
79
- - [FrozenSet](https://atomic-fns.dev/classes/Collections.FrozenSet.html)
80
- - [LRUCache](https://atomic-fns.dev/classes/Collections.LRUCache.html)
80
+ - [Deque](https://atomic-stack.github.io/atomic-fns/classes/collections.Deque.html)
81
+ - [FrozenSet](https://atomic-stack.github.io/atomic-fns/classes/collections.FrozenSet.html)
82
+ - [LRUCache](https://atomic-stack.github.io/atomic-fns/classes/collections.LRUCache.html)
81
83
 
82
84
 
83
85
  ## Contributing
@@ -1,8 +1,8 @@
1
1
  import { Mapping } from './abc.js';
2
2
  /**
3
3
  * A `SortedMap` is a map that holds key value pairs ordered by keys. Any primitive value (and objects that implement {@link Comparable} or {@link Ordered} interfaces) can be used as keys or values.
4
- * @see {@link Operators.compare}
5
- * @see {@link Operators.lt}
4
+ * @see {@link operators.compare}
5
+ * @see {@link operators.lt}
6
6
  * @template K, V
7
7
  */
8
8
  export declare class SortedMap<K, V> extends Mapping<K, V> {
@@ -2,8 +2,8 @@ import { Mapping } from './abc.js';
2
2
  import { SplayTree } from './SplayTree.js';
3
3
  /**
4
4
  * A `SortedMap` is a map that holds key value pairs ordered by keys. Any primitive value (and objects that implement {@link Comparable} or {@link Ordered} interfaces) can be used as keys or values.
5
- * @see {@link Operators.compare}
6
- * @see {@link Operators.lt}
5
+ * @see {@link operators.compare}
6
+ * @see {@link operators.lt}
7
7
  * @template K, V
8
8
  */
9
9
  export class SortedMap extends Mapping {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This module includes classes and functions to work with Container types.
3
3
  *
4
- * @module Collections
4
+ * @module collections
5
5
  */
6
6
  import { compare } from '../operators/index.js';
7
7
  import { Iteratee } from '../types';
@@ -15,6 +15,7 @@ export * from './SortedMap.js';
15
15
  export * from './SortedSet.js';
16
16
  export * from './SortedTree.js';
17
17
  export * from './SplayTree.js';
18
+ export * from './Trie.js';
18
19
  /**
19
20
  * Creates a new array with all falsy and empty values removed.
20
21
  * @param arr The array to compact
@@ -44,18 +45,6 @@ count(['one', 'two', 'three'], x => x.length);
44
45
  */
45
46
  export declare function count<T>(obj: T[], fn: Iteratee<T>): Record<string, number>;
46
47
  export declare function count<T>(obj: Object, fn: Iteratee<T>): Record<string, number>;
47
- /**
48
- * Creates a function that can be used to create named tuple-like objects.
49
- * @example
50
- ```js
51
- let Point = namedtuple('x', 'y', 'z')
52
- let userObj = User(0, 0, 0)
53
- // {x: 0, y: 0, z: 0}
54
- ```
55
- * @param fields - A list of field names
56
- * @returns A function that can be called with the field values
57
- */
58
- export declare const namedtuple: (...fields: string[]) => (...args: any[]) => any;
59
48
  /**
60
49
  * Iterates over elements of collection, returning an array of all elements where predicate returns truthy value.
61
50
  *
@@ -145,7 +134,7 @@ filter(objects, matches({ a: 4, c: 6 }))
145
134
  * @param shape
146
135
  * @returns
147
136
  */
148
- export declare const matches: (shape: any) => (obj: any) => boolean;
137
+ export declare function matches(shape: any): (obj: any) => boolean;
149
138
  /**
150
139
  * Iterates over elements of collection and invokes `iteratee` for each element. The iteratee is invoked with three arguments: `(value, index|key, collection)`. Iteratee functions may exit iteration early by explicitly returning `false`.
151
140
  * @example
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * This module includes classes and functions to work with Container types.
3
3
  *
4
- * @module Collections
4
+ * @module collections
5
5
  */
6
- import { call, get, isArray, isArrayLike, isBool, isEmpty, isFunction, isIterable, isNull, isNumber, isObject, isString, keys, set } from '../globals/index.js';
6
+ import { call, get, isArray, isArrayLike, isBool, isEmpty, isFunction, isIterable, isNull, isNumber, isObject, isString, keys } from '../globals/index.js';
7
7
  import { enumerate } from '../itertools/index.js';
8
8
  import { compare, eq, id } from '../operators/index.js';
9
9
  export * from './abc.js';
@@ -16,6 +16,7 @@ export * from './SortedMap.js';
16
16
  export * from './SortedSet.js';
17
17
  export * from './SortedTree.js';
18
18
  export * from './SplayTree.js';
19
+ export * from './Trie.js';
19
20
  export function compact(arr) {
20
21
  if (!arr)
21
22
  return;
@@ -37,18 +38,6 @@ export function count(obj, func) {
37
38
  });
38
39
  return counters;
39
40
  }
40
- /**
41
- * Creates a function that can be used to create named tuple-like objects.
42
- * @example
43
- ```js
44
- let Point = namedtuple('x', 'y', 'z')
45
- let userObj = User(0, 0, 0)
46
- // {x: 0, y: 0, z: 0}
47
- ```
48
- * @param fields - A list of field names
49
- * @returns A function that can be called with the field values
50
- */
51
- export const namedtuple = (...fields) => (...args) => fields.reduce((prev, f, i) => set(f, prev, args[i], false, true), {});
52
41
  export function filter(arr, fn = isNull) {
53
42
  if (!arr)
54
43
  return;
@@ -104,15 +93,17 @@ filter(objects, matches({ a: 4, c: 6 }))
104
93
  * @param shape
105
94
  * @returns
106
95
  */
107
- export const matches = (shape) => (obj) => {
108
- if (!shape || !obj)
109
- return false;
110
- for (const key in shape) {
111
- if (obj[key] !== shape[key])
96
+ export function matches(shape) {
97
+ return function (obj) {
98
+ if (!shape || !obj)
112
99
  return false;
113
- }
114
- return true;
115
- };
100
+ for (const key in shape) {
101
+ if (obj[key] !== shape[key])
102
+ return false;
103
+ }
104
+ return true;
105
+ };
106
+ }
116
107
  export function forEach(collection, fn) {
117
108
  if (Array.isArray(collection)) {
118
109
  for (let i = 0; i < collection.length; i++) {
@@ -8,7 +8,9 @@
8
8
  */
9
9
  export declare function decimal(x: any): Decimal;
10
10
  /**
11
- * `Decimal` provides support for correct rounded floating point arithmetic, unlike the standard Number type. It also supports user-defined precision (default is 20 decimal places) which can be as large as needed.
11
+ * `Decimal` provides support for correct rounded floating point arithmetic, unlike the standard
12
+ * `Number` type. It also supports user-defined precision (default is 20 decimal places), which
13
+ * can be as large as needed.
12
14
  */
13
15
  export declare class Decimal {
14
16
  static PRECISION: number;
@@ -25,7 +27,7 @@ export declare class Decimal {
25
27
  * @example
26
28
  ```js
27
29
  let a = decimal('5')
28
- a.minus() // -5
30
+ a.negated() // -5
29
31
  ```
30
32
  * @returns {Decimal}
31
33
  */
@@ -11,7 +11,9 @@ export function decimal(x) {
11
11
  return new Decimal(x);
12
12
  }
13
13
  /**
14
- * `Decimal` provides support for correct rounded floating point arithmetic, unlike the standard Number type. It also supports user-defined precision (default is 20 decimal places) which can be as large as needed.
14
+ * `Decimal` provides support for correct rounded floating point arithmetic, unlike the standard
15
+ * `Number` type. It also supports user-defined precision (default is 20 decimal places), which
16
+ * can be as large as needed.
15
17
  */
16
18
  export class Decimal {
17
19
  static PRECISION = 20;
@@ -86,7 +88,7 @@ export class Decimal {
86
88
  * @example
87
89
  ```js
88
90
  let a = decimal('5')
89
- a.minus() // -5
91
+ a.negated() // -5
90
92
  ```
91
93
  * @returns {Decimal}
92
94
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This module includes functions that promote a more functional programming style.
3
3
  *
4
- * @module Functions
4
+ * @module functools
5
5
  */
6
6
  import { Function } from '../globals/index.js';
7
7
  /**
@@ -12,13 +12,13 @@ import { Function } from '../globals/index.js';
12
12
  * @returns {Function} Returns the new bound function.
13
13
  * @see {@link partial}
14
14
  */
15
- export declare const bind: (fn: Function, thisArg: any, ...partials: any[]) => any;
15
+ export declare function bind(fn: Function, thisArg: any, ...partials: any[]): any;
16
16
  /**
17
17
  * Creates a function that accepts arguments of `func` and either invokes `func` returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining `func` arguments, and so on. The arity of `func` may be specified if `func.length` is not sufficient.
18
18
  * @param {Function} func The function to curry.
19
19
  * @returns Returns the new curried function.
20
20
  */
21
- export declare const curry: (func: Function) => (...args: any[]) => any;
21
+ export declare function curry(func: Function): (...args: any[]) => any;
22
22
  /**
23
23
  * Creates a function that invokes `fn` with partials prepended to the arguments it receives.
24
24
  * **Note:** The given function will have `this` bound to `undefined`. If using `this` inside `fn`, consider {@link bind} instead.
@@ -26,24 +26,24 @@ export declare const curry: (func: Function) => (...args: any[]) => any;
26
26
  * @param {...*} [args] The arguments to apply to `fn`.
27
27
  * @returns {Function} Returns the new partially applied function
28
28
  */
29
- export declare const partial: (fn: any, ...args: any[]) => any;
29
+ export declare function partial(fn: any, ...args: any[]): any;
30
30
  /**
31
31
  * Creates a function composition from a given set of functions that will be each applied on the result of the previous one from left to right.
32
32
  * @param {...*} [args] The set of functions to apply.
33
33
  * @returns {Function} A new function that applies each given function on the result of the previous one.
34
34
  */
35
- export declare const flow: (...args: any[]) => (x: any) => any;
35
+ export declare function flow(...args: any[]): (x: any) => any;
36
36
  /**
37
37
  * This is just an alias for the {@link flow} function.
38
38
  * @see {@link flow}
39
39
  */
40
- export declare const pipe: (...args: any[]) => (x: any) => any;
40
+ export declare const pipe: typeof flow;
41
41
  /**
42
42
  * Creates a function composition from a given set of functions that will be each applied on the result of the previous one from right to left.
43
43
  * @param {...*} [args] The set of functions to apply.
44
44
  * @returns {Function} A new function that applies each given function on the result of the previous step.
45
45
  */
46
- export declare const compose: (...args: any[]) => (x: any) => any;
46
+ export declare function compose(...args: any[]): (x: any) => any;
47
47
  /**
48
48
  * Creates a function that memoizes the result of `func`. If `resolver` is provided, it determines the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the map cache key.
49
49
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This module includes functions that promote a more functional programming style.
3
3
  *
4
- * @module Functions
4
+ * @module functools
5
5
  */
6
6
  /**
7
7
  * Creates a function that invokes `fn` with the this binding of `thisArg` and `partials` as partially applied arguments.
@@ -11,13 +11,15 @@
11
11
  * @returns {Function} Returns the new bound function.
12
12
  * @see {@link partial}
13
13
  */
14
- export const bind = (fn, thisArg, ...partials) => fn.bind(thisArg, ...partials);
14
+ export function bind(fn, thisArg, ...partials) {
15
+ return fn.bind(thisArg, ...partials);
16
+ }
15
17
  /**
16
18
  * Creates a function that accepts arguments of `func` and either invokes `func` returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining `func` arguments, and so on. The arity of `func` may be specified if `func.length` is not sufficient.
17
19
  * @param {Function} func The function to curry.
18
20
  * @returns Returns the new curried function.
19
21
  */
20
- export const curry = (func) => {
22
+ export function curry(func) {
21
23
  return function curried(...args) {
22
24
  if (args.length >= func.length) {
23
25
  return func.apply(this, args);
@@ -26,7 +28,7 @@ export const curry = (func) => {
26
28
  return curried.apply(this, args.concat(args2));
27
29
  };
28
30
  };
29
- };
31
+ }
30
32
  /**
31
33
  * Creates a function that invokes `fn` with partials prepended to the arguments it receives.
32
34
  * **Note:** The given function will have `this` bound to `undefined`. If using `this` inside `fn`, consider {@link bind} instead.
@@ -34,18 +36,22 @@ export const curry = (func) => {
34
36
  * @param {...*} [args] The arguments to apply to `fn`.
35
37
  * @returns {Function} Returns the new partially applied function
36
38
  */
37
- export const partial = (fn, ...args) => bind(fn, undefined, ...args);
39
+ export function partial(fn, ...args) {
40
+ return bind(fn, undefined, ...args);
41
+ }
38
42
  /**
39
43
  * Creates a function composition from a given set of functions that will be each applied on the result of the previous one from left to right.
40
44
  * @param {...*} [args] The set of functions to apply.
41
45
  * @returns {Function} A new function that applies each given function on the result of the previous one.
42
46
  */
43
- export const flow = (...args) => (x) => {
44
- for (const fn of args) {
45
- x = fn(x);
46
- }
47
- return x;
48
- };
47
+ export function flow(...args) {
48
+ return (x) => {
49
+ for (const fn of args) {
50
+ x = fn(x);
51
+ }
52
+ return x;
53
+ };
54
+ }
49
55
  /**
50
56
  * This is just an alias for the {@link flow} function.
51
57
  * @see {@link flow}
@@ -56,7 +62,9 @@ export const pipe = flow;
56
62
  * @param {...*} [args] The set of functions to apply.
57
63
  * @returns {Function} A new function that applies each given function on the result of the previous step.
58
64
  */
59
- export const compose = (...args) => flow(args.reverse());
65
+ export function compose(...args) {
66
+ return flow(args.reverse());
67
+ }
60
68
  /**
61
69
  * Creates a function that memoizes the result of `func`. If `resolver` is provided, it determines the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the map cache key.
62
70
  *
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * This module includes global functions and constants.
3
3
  *
4
- * @module Globals
4
+ * @module globals
5
5
  */
6
6
  /**
7
7
  * A generic function type with arbitrary arguments and return.
8
8
  */
9
9
  export declare type Function<TReturn = any> = (...args: any) => TReturn;
10
10
  /** This is just a noop function. */
11
- export declare const noop: () => void;
11
+ export declare function noop(): void;
12
12
  /** A function that always returns `true`. */
13
13
  export declare const True: () => boolean;
14
14
  /** A function that always returns `false`. */
@@ -76,60 +76,60 @@ export declare function type(value: any): string;
76
76
  * @returns `obj.toString()` or `''` if `obj` is `null` or `undefined`.
77
77
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString | Object.toString }
78
78
  */
79
- export declare const str: (obj: any) => any;
79
+ export declare function str(obj: any): any;
80
80
  /** Check if value is a boolean type. */
81
- export declare const isBool: (x: any) => x is boolean;
81
+ export declare function isBool(x: any): x is boolean;
82
82
  /** Check if value is an `Error` type. */
83
- export declare const isError: (x: any) => x is Error;
83
+ export declare function isError(x: any): x is Error;
84
84
  /** Check if value is an iterable type. */
85
- export declare const isIterable: (x: any) => x is IterableIterator<any>;
85
+ export declare function isIterable(x: any): x is IterableIterator<any>;
86
86
  /** Check if value is a native `Date` type. */
87
- export declare const isDate: (x: any) => x is Date;
87
+ export declare function isDate(x: any): x is Date;
88
88
  /** Check if value is an object type. */
89
- export declare const isObject: (x: any) => x is Object;
89
+ export declare function isObject(x: any): x is Object;
90
90
  /** Check if value is a string type. */
91
- export declare const isString: (x: any) => x is string;
91
+ export declare function isString(x: any): x is string;
92
92
  /** Check if value is an Array type. */
93
- export declare const isArray: (x: any) => x is any[];
93
+ export declare function isArray(x: any): x is any[];
94
94
  /**
95
95
  * Check if value is Array-like type.
96
96
  * A value is considered array-like if it's not a function and has a `.length` number property.
97
97
  */
98
- export declare const isArrayLike: (x: any) => boolean;
98
+ export declare function isArrayLike(x: any): boolean;
99
99
  /** Check if value is a number type. */
100
- export declare const isNumber: (x: any) => x is number;
100
+ export declare function isNumber(x: any): x is number;
101
101
  /** Check if value is an integer number type. */
102
- export declare const isInteger: (x: any) => x is number;
102
+ export declare function isInteger(x: any): x is number;
103
103
  /** Check if value is a bigint type. */
104
- export declare const isBigint: (x: any) => x is BigInt;
104
+ export declare function isBigint(x: any): x is BigInt;
105
105
  /** Check if value is a Promise type. */
106
- export declare const isPromise: (x: any) => x is Promise<any>;
106
+ export declare function isPromise(x: any): x is Promise<any>;
107
107
  /** Check if value is a function type. */
108
- export declare const isFunction: (x: any) => x is Function<any>;
108
+ export declare function isFunction(x: any): x is Function;
109
109
  /** Check if value is an async function type. */
110
- export declare const isAsyncFunction: (x: any) => boolean;
110
+ export declare function isAsyncFunction(x: any): boolean;
111
111
  /** Check if value is a generator function type. */
112
- export declare const isGenerator: (x: any) => x is Generator<unknown, any, unknown>;
112
+ export declare function isGenerator(x: any): x is Generator;
113
113
  /** Check if value is `null` or `undefined`. */
114
- export declare const isNull: (x: any) => x is null;
114
+ export declare function isNull(x: any): x is null | undefined;
115
115
  /** Check if value === `undefined`. */
116
- export declare const isUndefined: (x: any) => x is undefined;
116
+ export declare function isUndefined(x: any): x is undefined;
117
117
  /** Check if value is not `null` or `undefined`. */
118
- export declare const notNull: (x: any) => boolean;
118
+ export declare function notNull(x: any): boolean;
119
119
  /** Returns `true` for objects without length or falsy values. */
120
- export declare const isEmpty: (x: any) => boolean;
120
+ export declare function isEmpty(x: any): boolean;
121
121
  /** Check if value is a `RegExp` type */
122
- export declare const isRegExp: (x: any) => x is RegExp;
122
+ export declare function isRegExp(x: any): x is RegExp;
123
123
  /** Check if value is a `Symbol` type */
124
- export declare const isSymbol: (x: any) => x is symbol;
124
+ export declare function isSymbol(x: any): x is symbol;
125
125
  /** Check if value is a `Set` type. */
126
- export declare const isSet: <T>(x: any) => x is Set<T>;
126
+ export declare function isSet<T>(x: any): x is Set<T>;
127
127
  /** Check if value is a `Map` type. */
128
- export declare const isMap: <K, V>(x: any) => x is Map<K, V>;
128
+ export declare function isMap<K, V>(x: any): x is Map<K, V>;
129
129
  /** Check if value is a `WeakSet` type. */
130
- export declare const isWeakSet: <T extends object>(x: any) => x is WeakSet<T>;
130
+ export declare function isWeakSet<T extends object>(x: any): x is WeakSet<T>;
131
131
  /** Check if value is a `WeakMap` type. */
132
- export declare const isWeakMap: <K extends object, V>(x: any) => x is WeakMap<K, V>;
132
+ export declare function isWeakMap<K extends object, V>(x: any): x is WeakMap<K, V>;
133
133
  /**
134
134
  * Returns the number of elements in a collection type.
135
135
  *
@@ -152,7 +152,7 @@ uniqueId('user_')
152
152
  // 'user_1033763188'
153
153
  ```
154
154
  */
155
- export declare const uniqueId: (pre?: string) => string;
155
+ export declare function uniqueId(pre?: string): string;
156
156
  /**
157
157
  * Generates a monotonically increasing, pseudo-random based uuid-v4 string. These are sortable, url-friendly and are 100% unique if the IDs are generated more than 1 millisecond apart. If two IDs are generated at the same millisecond, the chance of collision is still pretty low (1 in 10^15).
158
158
  * @returns Returns a GUID formatted string.
@@ -162,7 +162,7 @@ uuid()
162
162
  // '183f8ef3-b8f0-4000-81f5-89234c836d00'
163
163
  ```
164
164
  */
165
- export declare const uuid: () => string;
165
+ export declare function uuid(): string;
166
166
  /**
167
167
  * Checks if `obj.key` is a function, and calls it with any given `args`.
168
168
  * @param {*} obj
@@ -172,30 +172,30 @@ export declare const uuid: () => string;
172
172
  */
173
173
  export declare function call(obj: any, key: PropertyKey, ...args: any[]): any;
174
174
  /** Convert number to unicode character */
175
- export declare const chr: (x: number) => string;
175
+ export declare function chr(x: number): string;
176
176
  /** Convert character to Unicode code point */
177
- export declare const ord: (x: string) => number;
177
+ export declare function ord(x: string): number;
178
178
  /**
179
179
  * Returns an array of the own enumerable property names of `object`.
180
180
  * @param object The given object.
181
181
  * @returns The array of object keys.
182
182
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys Object.keys()}
183
183
  */
184
- export declare const keys: <T>(object: T) => (keyof T)[];
184
+ export declare function keys<T>(object: T): (keyof T)[];
185
185
  /**
186
186
  * Returns an array of the own enumerable property values of `object`.
187
187
  * @param object The given object.
188
188
  * @returns The array of object keys.
189
189
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values Object.values()}
190
190
  */
191
- export declare const values: (object: any) => unknown[];
191
+ export declare function values(object: any): unknown[];
192
192
  /**
193
193
  * Check if a given property is present in a given object.
194
194
  * @param obj The object to check.
195
195
  * @param attr A property key name.
196
196
  * @returns `true` if the object has the property name.
197
197
  */
198
- export declare const has: (obj: any, attr: PropertyKey) => boolean;
198
+ export declare function has(obj: any, attr: PropertyKey): boolean;
199
199
  /**
200
200
  * Check if the attribute is present in the object or return a default value instead.
201
201
  * @param {PropertyKey} key
@@ -242,40 +242,40 @@ export declare function hashCode(str: string): number;
242
242
  * @param n The given number.
243
243
  * @returns The binary string representation of `n`.
244
244
  */
245
- export declare const bin: (n: number) => string;
245
+ export declare function bin(n: number): string;
246
246
  /**
247
247
  * Converts a number to a hexadecimal string.
248
248
  * @param n The given number.
249
249
  * @returns The hexadecimal string representation of `n`.
250
250
  */
251
- export declare const hex: (n: number) => string;
251
+ export declare function hex(n: number): string;
252
252
  /**
253
253
  * Converts a number to an octal string.
254
254
  * @param n The given number.
255
255
  * @returns The octal string representation of `n`.
256
256
  */
257
- export declare const oct: (n: number) => string;
257
+ export declare function oct(n: number): string;
258
258
  /**
259
259
  * Returns a floating point number constructed from a number or string `x`.
260
260
  * @param x The number or string.
261
261
  * @returns A floating point number parsed from the given value or `NaN`.
262
262
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat parseFloat}
263
263
  */
264
- export declare const float: (x: string) => number;
264
+ export declare function float(x: string): number;
265
265
  /**
266
266
  * Returns an integer number constructed from a number or string `x`.
267
267
  * @param x The number or string.
268
268
  * @returns An integer number parsed from the given value or `NaN`.
269
269
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt parseInt}
270
270
  */
271
- export declare const int: (x: string, base?: number) => number;
271
+ export declare function int(x: string, base?: number): number;
272
272
  /**
273
273
  * Converts the value to an array using `Array.from()`.
274
274
  * @param value
275
275
  * @returns A new array value.
276
276
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from Array.from()}
277
277
  */
278
- export declare const list: <T>(value?: any) => T[];
278
+ export declare function list<T>(value?: any): T[];
279
279
  /**
280
280
  * Retrieve the next item from the iterator by calling its `next()` method.
281
281
  * @param iter The iterator.