rainboom

1.1.0 • Public • Published

Rainboom

Iteration library.

standard

Constants

Generators

  • range: Range of values from .start to .end inclusive
  • ind: Range of values from 0 inclusive to .count exclusive
  • fibonacci: Fibonacci sequence starting with 0 then 1
  • prime: Prime number
  • factors: Prime factors of .input in order of size
  • exponent: Value where each value is .func(last) starting with .start
  • single: just .val
  • constant: .val repeated forever
  • entries: Object.entries of .obj
  • values: Object.values of .obj
  • keys: Object.entries of .obj
  • fromArray: Converts values in .arr into iterable, if .arr is not an array, equivalent to [.arr]

Reducers

  • reduce: Reduce sequence with .func starting with .start
  • first: First value in sequence
  • every: True if every value in sequence passes .test
  • some: True if some values in sequence pass .test
  • nth: .pos value in sequence, otherwise undefined
  • biggest: Biggest value in sequence, can compare by function
  • smallest: Smallest value in sequence, can compare by function
  • sum: Sum of values in sequence
  • toArray: Values as array
  • toSet: Values as set
  • toString: Values as string, joined with .del
  • last: Last value in sequence
  • head: Alias of first
  • toObject: Sequence converted to entries in object
  • has: True if sequence has all passed values
  • hasOnly: True if sequence has only passed values
  • hasAny: True if sequence has any of passed values
  • find: Returns first value in sequence to pass .test
  • fallback: Exectute .func on sequence, return .fb if .func return undefined, otherwise return result
  • forEach: Exectute .func with each value in sequence, return undefined
  • eat: Calculate sequence, return undefined
  • size: Length of sequence

transformers

  • concat: Push .newVal to end of sequence
  • contain: Execute .func with source and supplant with result
  • drop: Exclude first .count items
  • dup: Convert to sequence where each value is source
  • filter: Exclude value that fail .test
  • flatten: If value is iterable iterate through and return
  • init: All but last value
  • inject: Execute .func for each value, does not modify sequence
  • layer: When value is undefined take corresponding value from .source
  • log: Log each value in sequence
  • map: Apply .func to each value
  • merge: All combination of source and .iter values
  • padEnd: Append .scalar to sequence .count times
  • padStart: Prepend .scalar to sequence .count times
  • pourIn: When value is undefined take one value from .source
  • prepend: Push .newVal to start of sequence
  • push: Add .newVal to end of sequence
  • repeat: Loop sequence
  • replace: If value is .from return .too
  • slice: value at .start to value at .end
  • snip: Values up to and excluding first to fail test
  • snipStart: Values starting from first to fail .test
  • supplant: Replace current source with .iter
  • tail: All but first value
  • take: Take .num values from sequence
  • zip: One value from each .iterable and source into array

Package Sidebar

Install

npm i rainboom

Weekly Downloads

1

Version

1.1.0

License

ISC

Last publish

Collaborators

  • errorstream