File "push.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/array/push/push.ts
File size: 372 B (372 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

import { toArray } from '../toArray/toArray';


/**
 * Extended `Array#push()` that accepts an item or an array with items.
 *
 * @param array - An array to push items.
 * @param items - An item or items to push.
 *
 * @return A provided array itself.
 */
export function push<T>( array: T[], items: T | T[] ): T[] {
  array.push( ...toArray( items ) );
  return array;
}