Skip to content

Releases: libsugar/sugar.js

2.12.0-beta.4

06 Nov 15:44
Compare
Choose a tag to compare
2.12.0-beta.4 Pre-release
Pre-release
  • Add
    • guard function

      guard<{ a: 1 }>({ a: 1 }) => { a: 1 }
    • tuple function

      tuple(1, 2, 3) => [1, 2, 3]
    • Pair type

      Pair<K, V> => [K, V]
    • ReadonlyPair type

      ReadonlyPair<K, V> => readonly [K, V]
    • AnyPair type

      AnyPair<K, V> => [K, V] | readonly [K, V]
    • PairKey type

      PairKey<[1, 2]> => 1
    • PairValue type

      PairKey<[1, 2]> => 2
    • seq.mapKey

    • seq.mapValue

    • seq.arr

2.12.0-beta.3

28 Oct 12:27
Compare
Choose a tag to compare
2.12.0-beta.3 Pre-release
Pre-release
  • Add
    • OnceIter

      Cache the results of the iterator

    • pipe

      fp style pipe function

      Example

      const f = pipe(
          (a: number, b: number) => a + b,
          (a: number) => a + 2,
      )
      f(1, 2) // => 5
    • seq/ops
      move seq ops from seq to seq/ops

    • seq/fp

      fp style seq ops

    • seq/linq

      linq style seq alias

    • seq.includes

      same as array.includes

    • se.sum

    • seq.avg

    • seq.toArray

    • seq.toSet

    • seq.toMap

    • static Seq.empty

      Create empty seq

      Example

      Seq.empty<number>()
    • static Seq.to

      Create a Seq from a range starting from 0

      Example

      Seq.to(3) // [0, 1, 2]
    • static Seq.range

      Create a Seq from a range

      Example

      Seq.range(3, 6) // [3, 4, 5]
    • seq.push

      like array.push

    • seq.unshift

      like array.unshift

    • seq.as

      cast types

    • seq.groupBy

      linq groupBy

    • seq.product

      Cartesian product

      Example

      seq([1, 2, 3]).product(['a', 'b'])
      // returns
      [
          [1, 'a'],
          [1, 'b'],
          [2, 'a'],
          [2, 'b'],
          [3, 'a'],
          [3, 'b'],
      ]
    • seq.relate

      sql inner join

      Example

      seq([1, 2, 3]).relate(['1', '2', '3'], a => a, b => +b)
      // returns
      [
          [1, '1'],
          [2, '2'],
          [3, '3'],
      ]

2.11.0

18 Oct 13:20
Compare
Choose a tag to compare
  • Add
    • Linked<T>, LinkedNode<T>

      Doubly Linked List

      Example

      const l = new Linked<number>()
      l.push(1)

2.9.0

09 Oct 16:30
Compare
Choose a tag to compare
  • Add
    • AsyncPool

      Asynchronous pool
      Used to ensure that the number of asynchronous executions at the same time does not exceed the limit

      Example

      const pool = new AsyncPool(1000)
      pool.run(() => fetch('foo/bar'))

2.8.0

02 Oct 06:07
Compare
Choose a tag to compare

Add types

  • TupleConcat
  • KeyofExcludeValue
  • KeyofExtractValue
  • PickValue
  • OmitValue
  • ObjFromEntries
  • ObjKeys
  • ObjVals
  • ObjEntry
  • EntryValue
  • EntryKey
  • ObjPath
  • ValByPath
  • ObjPathEntry

2.4.1

04 Jul 12:16
Compare
Choose a tag to compare

seq & flu

2.2.0

03 Feb 14:08
Compare
Choose a tag to compare
doc

2.1.0

03 Feb 09:26
Compare
Choose a tag to compare
Merge branch 'master' of https://github.com/libsugar/sugar.js into ma…

…ster

2.0.0

25 Dec 05:10
Compare
Choose a tag to compare
doc

1.4.0

20 May 08:05
Compare
Choose a tag to compare
build