Skip to content

A conceptual javascript utility for array-like objects that builds on Array#reduce and Array#splice

License

Notifications You must be signed in to change notification settings

gconnolly/flatline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

_Λ_Λ_Λ_____flatline

An conceptual javascript utility library for array-like objects requiring a very limited interface:

var ArrayLike = function () {
  this.length = 0;

  /* iteration */
  this.reduce = function (callback[, initialValue]) {};

  /* mutation */
  this.splice = function (start, deleteCount[, item1[, item2[, ...]]]) {};
};

The objectives is to clearly demonstrate the flexibility of Array#reduce, Array#splice and then to a lesser extent... you know... be accurate and robust. That being said, there is a smattering of unit tests to back it up.

functions implemented using reduce:

  • reduce, foldl, inject
  • reduceRight, foldr
  • map, collect
  • forEach, each
  • filter, select
  • reject
  • contains, includes, include
  • compact
  • some, any
  • all, every
  • find, detect
  • findIndex
  • first, head, take
  • rest, tail, drop
  • groupBy
  • countBy
  • indexBy
  • partition
  • flatten
  • shuffle
  • sample
  • reverse
  • min, max
  • intersection
  • union
  • unique, uniq
  • invoke
  • slice

functions implemented not using reduce

  • random
  • negate
  • identity
  • toArray

About

A conceptual javascript utility for array-like objects that builds on Array#reduce and Array#splice

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published