All files / roosterjs-content-model-dom/lib/domUtils toArray.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36                                                                1x 764x    
/**
 * Convert a named node map to an array
 * @param collection The map to convert
 */
export function toArray(collection: NamedNodeMap): Attr[];
 
/**
 * Convert a named node map to an array
 * @param collection The map to convert
 */
export function toArray(collection: DataTransferItemList): DataTransferItem[];
 
/**
 * Convert a collection to an array
 * @param collection The collection to convert
 */
export function toArray<T extends Node>(collection: NodeListOf<T>): T[];
 
/**
 * Convert a collection to an array
 * @param collection The collection to convert
 */
export function toArray<T extends Element>(collection: HTMLCollectionOf<T>): T[];
 
/**
 * Convert an array to an array.
 * This is to satisfy typescript compiler. For some cases the object can be a collection at runtime,
 * but the declaration is an array. e.g. ClipboardData.types
 * @param array The array to convert
 */
export function toArray<T>(array: readonly T[]): T[];
 
export function toArray(collection: any): any[] {
    return [].slice.call(collection);
}