Skip to content

Latest commit

 

History

History

array

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Array


MIT License

Array extensions

Table of contents

Usage

import {
  all,
  any,
  binarySearch,
  chunks,
  clear,
  contains,
  endsWith,
  enumerate,
  filled,
  firstItem,
  fold,
  insert,
  isEmpty,
  isSorted,
  iter,
  lastIndex,
  lastItem,
  len,
  max,
  min,
  partition,
  product,
  reject,
  remove,
  repeat,
  retain,
  select,
  shuffle,
  split,
  splitAt,
  startsWith,
  sum,
  truncate,
} from 'jsmodern/dist/array.js';
import { extend } from 'jsmodern';

extend({
  array: [
    all,
    any,
    binarySearch,
    chunks,
    clear,
    contains,
    endsWith,
    enumerate,
    filled,
    firstItem,
    fold,
    insert,
    isEmpty,
    isSorted,
    iter,
    lastIndex,
    lastItem,
    len,
    max,
    min,
    partition,
    product,
    reject,
    remove,
    repeat,
    retain,
    select,
    shuffle,
    split,
    splitAt,
    startsWith,
    sum,
    truncate,
  ],
});

console.log([
  Array.prototype.all,
  Array.prototype.any,
  Array.prototype.binarySearch,
  Array.prototype.chunks,
  Array.prototype.clear,
  Array.prototype.contains,
  Array.prototype.endsWith,
  Array.prototype.enumerate,
  Array.filled,
  Array.prototype.firstItem,
  Array.prototype.fold,
  Array.prototype.insert,
  Array.prototype.isEmpty,
  Array.prototype.isSorted,
  Array.prototype.iter,
  Array.prototype.lastIndex,
  Array.prototype.lastItem,
  Array.prototype.len,
  Array.prototype.max,
  Array.prototype.min,
  Array.prototype.partition,
  Array.prototype.product,
  Array.prototype.reject,
  Array.prototype.remove,
  Array.prototype.repeat,
  Array.prototype.retain,
  Array.prototype.select,
  Array.prototype.shuffle,
  Array.prototype.split,
  Array.prototype.splitAt,
  Array.prototype.startsWith,
  Array.prototype.sum,
  Array.prototype.truncate,
].every(n => 'function' === typeof(n)));

Available extensions

Check out API Reference.

License

MIT License © Rong Sen Ng