UNPKG

@adyen/kyc-components

Version:

`adyen-kyc-components` provides the required pieces to build an onboarding flow based on a legal entity. To onboard and verify users, you need to create a user interface (UI) to collect user data. To speed up building your integration, Adyen offers onboar

60 lines (59 loc) 3.07 kB
import type { RecursiveKeyOf } from './getNestedPropertyKeys'; /** * 'Destructures' properties from object - returns a new object only containing those properties that were asked for (including if those properties * have values that are falsy: null, undefined, false, ''). * * @param propertiesToKeep - property names to select: can be either 'regular' arguments (comma separated list) or an array * @returns - an object with a function 'from' that accepts a single argument - the object from which to choose properties. * This function returns a new object - a copy of the original but only including the desired properties * * @example const strippedObj = pick('cardType', 'securityCode').from(cardObject); * @example const strippedObj = pick(['cardType', 'securityCode']).from(cardObject); */ export declare const pick: (...propertiesToKeep: (string | number | symbol)[]) => { from: <T extends object>(obj: T) => T; }; /** *'Destructures' properties from object, returning a new object containing all the original objects properties except those that were specifically rejected * * @param propertiesToDrop - property names to reject: can be either 'regular' arguments (comma separated list) or an array * @returns - an object with a function 'from' that accepts a single argument - the object from which to reject properties. * This function returns a new object - a copy of the original but excluding the selected properties * * @example const strippedObj = drop('permittedLengths', 'pattern', 'startingRules').from(cardObject); * @example const strippedObj = drop(['permittedLengths', 'pattern', 'startingRules']).from(cardObject); */ export declare const drop: <Property extends string>(...propertiesToDrop: Property[]) => { from: <T extends Partial<Record<Property, any>>>(obj: T) => Omit<T, Property>; }; /** * Compares 2 arrays of (primitive) values to see if they are the same * re. https://sebhastian.com/javascript-compare-array/ */ export declare const doArraysMatch: <T>(arr1: T[] | readonly T[], arr2: T[] | readonly T[]) => boolean; /** * Recursively compare 2 objects */ export declare const objectsDeepEqual: (x: unknown, y: unknown) => boolean; export declare function cloneObject<T>(object: T): T; export declare function cloneObject<T extends unknown[]>(object: T[]): T[]; /** * @param obj - object to reverse * @example * ``` * let obj = {a:1,b:2,c:3}; * reverseObject(obj); => {1:'a', 2: 'b', 3: 'c'} * ``` */ export declare function reverseObject<Source extends object, Target extends object>(obj: Partial<Record<RecursiveKeyOf<Target>, RecursiveKeyOf<Source>>>): Source; type ListifyOptions<ItemType> = { type?: Intl.ListFormatOptions['type']; style?: Intl.ListFormatOptions['style']; stringify?: (item: ItemType) => string; }; export declare function listify<ItemType extends { toString(): string; }>(array: ItemType[], { type, style, stringify, }?: ListifyOptions<ItemType>): string; export declare const noop: () => void; export declare const asyncNoop: () => Promise<void>; export {};