@wixc3/common
Advanced tools
Comparing version 14.0.0 to 14.1.0
{ | ||
"name": "@wixc3/common", | ||
"version": "14.0.0", | ||
"version": "14.1.0", | ||
"description": "Common utils, usable in all environments", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -96,6 +96,6 @@ import { | ||
: value === null | ||
? [null] | ||
: typeof value === 'object' && Symbol.iterator in value | ||
? value | ||
: [value] | ||
? [null] | ||
: typeof value === 'object' && Symbol.iterator in value | ||
? value | ||
: [value] | ||
) as Iter<T>; | ||
@@ -114,4 +114,4 @@ | ||
chainIter( | ||
(v as (iterable: Iterable<unknown>, ...args: unknown[]) => Iterable<unknown>)(iterable, ...args) | ||
) | ||
(v as (iterable: Iterable<unknown>, ...args: unknown[]) => Iterable<unknown>)(iterable, ...args), | ||
), | ||
); | ||
@@ -122,3 +122,3 @@ const boundToElm = mapValues( | ||
(...args: unknown[]) => | ||
chainElement((v as (iterable: Iterable<unknown>, ...args: unknown[]) => unknown)(iterable, ...args)) | ||
chainElement((v as (iterable: Iterable<unknown>, ...args: unknown[]) => unknown)(iterable, ...args)), | ||
); | ||
@@ -125,0 +125,0 @@ |
@@ -47,3 +47,3 @@ import { sleep } from 'promise-assist'; | ||
fn: T, | ||
wait: number | ||
wait: number, | ||
): (...args: Parameters<T>) => Promise<ReturnType<T>> { | ||
@@ -58,3 +58,3 @@ let queue: Promise<ReturnType<T> | void> | null = null; | ||
() => fn(...args) as ReturnType<T>, | ||
() => fn(...args) as ReturnType<T> | ||
() => fn(...args) as ReturnType<T>, | ||
); | ||
@@ -90,3 +90,3 @@ } | ||
() => fn(...args), | ||
() => fn(...args) | ||
() => fn(...args), | ||
); | ||
@@ -93,0 +93,0 @@ return queue; |
@@ -328,4 +328,4 @@ import { isDefined, Nullable } from './types'; | ||
}, | ||
new Map<T[K], T[]>() | ||
new Map<T[K], T[]>(), | ||
); | ||
} |
@@ -42,6 +42,6 @@ import { sleep } from 'promise-assist'; | ||
obj: T, | ||
mapping: (value: T[keyof T], k?: keyof T) => R | ||
mapping: (value: T[keyof T], k?: keyof T) => R, | ||
): { [_ in keyof T]: R } { | ||
return Object.fromEntries( | ||
Object.entries(obj).map(([k, v]: [string, T[keyof T]]) => [k, mapping(v, k as keyof T)]) | ||
Object.entries(obj).map(([k, v]: [string, T[keyof T]]) => [k, mapping(v, k as keyof T)]), | ||
) as { [_ in keyof T]: R }; | ||
@@ -55,6 +55,6 @@ } | ||
obj: object, | ||
mapping: (key: keyof T, value?: T[keyof T]) => R | ||
mapping: (key: keyof T, value?: T[keyof T]) => R, | ||
): Record<R, T[keyof T]> { | ||
return Object.fromEntries( | ||
Object.entries(obj).map(([k, v]: [string, T[keyof T]]) => [mapping(k as keyof T, v), v]) | ||
Object.entries(obj).map(([k, v]: [string, T[keyof T]]) => [mapping(k as keyof T, v), v]), | ||
) as Record<R, T[keyof T]>; | ||
@@ -104,3 +104,3 @@ } | ||
}, | ||
Key extends string | ||
Key extends string, | ||
>(obj: In): Promise<Out> { | ||
@@ -169,3 +169,3 @@ const out = {} as Record<string, any>; | ||
deep = true, | ||
shouldUseDefault = (v: unknown, _key: string) => v === undefined | ||
shouldUseDefault = (v: unknown, _key: string) => v === undefined, | ||
): S & D { | ||
@@ -247,6 +247,6 @@ const parseObj = (src: unknown, dft: unknown, parentKey = ''): Record<string, unknown> => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
[(rename as any)[key] || key, value] as [string, any] | ||
).iterable | ||
[(rename as any)[key] || key, value] as [string, any], | ||
).iterable, | ||
) as Remapped<T, R>; | ||
// @ts-expect-error setting the DELETE const | ||
remap.DELETE = DELETE; |
@@ -107,3 +107,3 @@ import { getIn } from './objects'; | ||
const words = splitIntoWords(str).map((word, index) => | ||
index > 0 ? capitalizeFirstLetter(word.toLowerCase()) : word.toLowerCase() | ||
index > 0 ? capitalizeFirstLetter(word.toLowerCase()) : word.toLowerCase(), | ||
); | ||
@@ -160,3 +160,3 @@ return words.join(''); | ||
pos: number, | ||
newline = '\n' | ||
newline = '\n', | ||
): { character: number; line: number } { | ||
@@ -163,0 +163,0 @@ if (pos > content.length) { |
@@ -51,5 +51,5 @@ import { expect } from 'chai'; | ||
.flatMap((i) => i) | ||
.filter((i) => i < 10).array | ||
.filter((i) => i < 10).array, | ||
).to.eql([2, 4, 3, 6, 4, 8, 5, 6, 7, 8, 9]); | ||
}); | ||
}); |
@@ -116,5 +116,5 @@ import { expect } from 'chai'; | ||
yield 1; | ||
})() | ||
})(), | ||
), | ||
'generated iterator' | ||
'generated iterator', | ||
).to.eql(2); | ||
@@ -165,5 +165,5 @@ }); | ||
[2, [{ a: 2 }]], | ||
]) | ||
]), | ||
); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
364074