mielk-fn 1.0.6 → 1.0.7
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/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/methods/arrays.d.ts +3 -0
- package/lib/methods/arrays.js +3 -0
- package/lib/methods/strings.d.ts +4 -0
- package/lib/methods/strings.js +7 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.objects = exports.arrays = void 0;
|
|
6
|
+
exports.strings = exports.objects = exports.arrays = void 0;
|
|
7
7
|
const arrays_1 = __importDefault(require("./methods/arrays"));
|
|
8
8
|
exports.arrays = arrays_1.default;
|
|
9
9
|
const objects_1 = __importDefault(require("./methods/objects"));
|
|
10
10
|
exports.objects = objects_1.default;
|
|
11
|
+
const strings_1 = __importDefault(require("./methods/strings"));
|
|
12
|
+
exports.strings = strings_1.default;
|
package/lib/methods/arrays.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
type NumberFunction = (item: any) => number;
|
|
2
2
|
type StringNumberFunction = (item: any) => string | number;
|
|
3
3
|
type AnyFunction = (item: any) => any;
|
|
4
|
+
declare const toMap: (items: any[], keyCallback: StringNumberFunction, valueFn?: AnyFunction, ignoreDuplicates?: boolean) => Map<any, any>;
|
|
5
|
+
declare const toIndexedArray: (items: any[], callback: NumberFunction) => any[];
|
|
6
|
+
export { toMap, toIndexedArray };
|
|
4
7
|
declare const _default: {
|
|
5
8
|
toMap: (items: any[], keyCallback: StringNumberFunction, valueFn?: AnyFunction, ignoreDuplicates?: boolean) => Map<any, any>;
|
|
6
9
|
toIndexedArray: (items: any[], callback: NumberFunction) => any[];
|
package/lib/methods/arrays.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toIndexedArray = exports.toMap = void 0;
|
|
3
4
|
const toMap = (items, keyCallback, valueFn = (item) => item, ignoreDuplicates = true) => {
|
|
4
5
|
const map = new Map();
|
|
5
6
|
items.forEach((item) => {
|
|
@@ -13,6 +14,7 @@ const toMap = (items, keyCallback, valueFn = (item) => item, ignoreDuplicates =
|
|
|
13
14
|
});
|
|
14
15
|
return map;
|
|
15
16
|
};
|
|
17
|
+
exports.toMap = toMap;
|
|
16
18
|
const toIndexedArray = (items, callback) => {
|
|
17
19
|
const arr = [];
|
|
18
20
|
items.forEach((item) => {
|
|
@@ -27,4 +29,5 @@ const toIndexedArray = (items, callback) => {
|
|
|
27
29
|
});
|
|
28
30
|
return arr;
|
|
29
31
|
};
|
|
32
|
+
exports.toIndexedArray = toIndexedArray;
|
|
30
33
|
exports.default = { toMap, toIndexedArray };
|