@punks/backend-core 0.0.20 → 0.0.22
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/dist/cjs/index.js +18 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/utils/array.d.ts +3 -1
- package/dist/cjs/types/utils/csv.d.ts +1 -1
- package/dist/cjs/types/utils/index.d.ts +1 -1
- package/dist/esm/index.js +16 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/utils/array.d.ts +3 -1
- package/dist/esm/types/utils/csv.d.ts +1 -1
- package/dist/esm/types/utils/index.d.ts +1 -1
- package/dist/index.d.ts +5 -3
- package/package.json +1 -1
|
@@ -3,8 +3,10 @@ export declare const indexes: (startIndex: number, count: number) => number[];
|
|
|
3
3
|
export interface Dict<TVal> {
|
|
4
4
|
[key: string]: TVal;
|
|
5
5
|
}
|
|
6
|
-
export declare const toDict: <TVal>(array: TVal[],
|
|
6
|
+
export declare const toDict: <TVal>(array: TVal[], keySelector: (value: TVal) => string) => Dict<TVal>;
|
|
7
|
+
export declare const toItemsDict: <TItem, TVal>(array: TItem[], keySelector: (value: TItem) => string, elementSelector: (value: TItem) => TVal) => Dict<TVal>;
|
|
7
8
|
export declare const toMap: <TKey, TVal>(array: TVal[], key: (val: TVal) => TKey) => Map<TKey, TVal>;
|
|
9
|
+
export declare const toItemsMap: <TItem, TKey, TVal>(array: TItem[], key: (val: TItem) => TKey, element: (val: TItem) => TVal) => Map<TKey, TVal>;
|
|
8
10
|
export declare const last: <T>(arr: T[]) => T;
|
|
9
11
|
export declare const first: <T>(arr: T[]) => T;
|
|
10
12
|
type ArrayComparer<T> = (a: T, b: T) => number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const csvParse: (data: string | string[] | Buffer, separator?: string) => Record<string, any>[];
|
|
3
3
|
export interface CsvColumnDefinition<T> {
|
|
4
4
|
name: string;
|
|
5
5
|
value: (item: T) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./array";
|
|
2
|
-
export { CsvColumnDefinition as ColumnDefinition, CsvBuildOptions, csvBuild,
|
|
2
|
+
export { CsvColumnDefinition as ColumnDefinition, CsvBuildOptions, csvBuild, csvParse, } from "./csv";
|
|
3
3
|
export { getDirectoryFilePaths } from "./files";
|
|
4
4
|
export { joinPath, splitPath, ensureDirectory, getDirectoryPath } from "./paths";
|
|
5
5
|
export * from "./strings";
|
package/dist/index.d.ts
CHANGED
|
@@ -45,8 +45,10 @@ declare const indexes: (startIndex: number, count: number) => number[];
|
|
|
45
45
|
interface Dict<TVal> {
|
|
46
46
|
[key: string]: TVal;
|
|
47
47
|
}
|
|
48
|
-
declare const toDict: <TVal>(array: TVal[],
|
|
48
|
+
declare const toDict: <TVal>(array: TVal[], keySelector: (value: TVal) => string) => Dict<TVal>;
|
|
49
|
+
declare const toItemsDict: <TItem, TVal>(array: TItem[], keySelector: (value: TItem) => string, elementSelector: (value: TItem) => TVal) => Dict<TVal>;
|
|
49
50
|
declare const toMap: <TKey, TVal>(array: TVal[], key: (val: TVal) => TKey) => Map<TKey, TVal>;
|
|
51
|
+
declare const toItemsMap: <TItem, TKey, TVal>(array: TItem[], key: (val: TItem) => TKey, element: (val: TItem) => TVal) => Map<TKey, TVal>;
|
|
50
52
|
declare const last: <T>(arr: T[]) => T;
|
|
51
53
|
declare const first: <T>(arr: T[]) => T;
|
|
52
54
|
type ArrayComparer<T> = (a: T, b: T) => number;
|
|
@@ -62,7 +64,7 @@ declare const distinctElements: <T>(values: T[], comparer: (value: T) => any) =>
|
|
|
62
64
|
declare const jsonDistinct: <T>(values: T[]) => T[];
|
|
63
65
|
declare const iterate: <T>(values: T[], action: (item: T, next?: T | undefined, prev?: T | undefined) => void) => void;
|
|
64
66
|
|
|
65
|
-
declare const
|
|
67
|
+
declare const csvParse: (data: string | string[] | Buffer, separator?: string) => Record<string, any>[];
|
|
66
68
|
interface CsvColumnDefinition<T> {
|
|
67
69
|
name: string;
|
|
68
70
|
value: (item: T) => any;
|
|
@@ -123,4 +125,4 @@ type ExcelParseOptions = {
|
|
|
123
125
|
};
|
|
124
126
|
declare const excelParse: (file: string | ArrayBuffer, options?: ExcelParseOptions) => any[];
|
|
125
127
|
|
|
126
|
-
export { CsvColumnDefinition as ColumnDefinition, CsvBuildOptions, Dict, ExcelKeyTransform, ExcelParseOptions, ExcelColumnDefinition as ExcelRowBuilder, ExcelSheetDefinition, ILogger, ILoggerProvider, IResolveServiceOptions, IServiceLocator, Log, LogLevel, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, csvBuild,
|
|
128
|
+
export { CsvColumnDefinition as ColumnDefinition, CsvBuildOptions, Dict, ExcelKeyTransform, ExcelParseOptions, ExcelColumnDefinition as ExcelRowBuilder, ExcelSheetDefinition, ILogger, ILoggerProvider, IResolveServiceOptions, IServiceLocator, Log, LogLevel, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, csvBuild, csvParse, distinct, distinctElements, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, getDirectoryFilePaths, getDirectoryPath, indexes, isNullOrUndefined, iterate, joinPath, jsonDistinct, last, newUuid, notNull, notUndefined, pluralize, range, removeUndefinedProps, selectMany, sleep, sort, splitPath, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim, trimEnd, trimStart };
|