@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
50 lines (49 loc) • 2.7 kB
TypeScript
/**
* '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[];
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 {};