mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
feat: migrate to esm
This commit is contained in:
@@ -16,7 +16,10 @@
|
||||
/**
|
||||
* Pick a set of properties from an object
|
||||
*/
|
||||
export function pick<T extends object, U extends keyof T>(object: T, keys: U[]): Pick<T, U> {
|
||||
export function pick<T extends object, U extends keyof T>(
|
||||
object: T,
|
||||
keys: U[]
|
||||
): Pick<T, U> {
|
||||
return keys.reduce((accumulator, key) => {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
accumulator[key] = object[key];
|
||||
@@ -30,7 +33,7 @@ export function pick<T extends object, U extends keyof T>(object: T, keys: U[]):
|
||||
*/
|
||||
export function pickBy<T extends object, U extends keyof T>(
|
||||
object: T,
|
||||
predicate: (value: T[U], key: U) => boolean,
|
||||
predicate: (value: T[U], key: U) => boolean
|
||||
): Pick<T, U> {
|
||||
return (Object.keys(object) as U[]).reduce((accumulator, key) => {
|
||||
if (predicate(object[key], key)) {
|
||||
|
||||
Reference in New Issue
Block a user