Skip to content

Releases: chharvey/extrajs

v0.27.0

Choose a tag to compare

@chharvey chharvey released this 14 Feb 04:24

Non-Breaking

New Classes

  • Stack

New Methods

  • new method xjs.Array.forEither
    • Executes a callback on each item of an array until that callback returns. (The “dual” of xjs.Array.forEach)
  • rename DeletableQueue -> EditableQueue and add new methods:
    • #promoteByIndex(index: number, slots?: number)
    • #demoteByIndex(index: number, slots?: number)
    • #promoteByIndexToStart(index: number)
    • #demoteByIndexToEnd(index: number)
    • #promote(item: T / predicate: (T) => boolean, slots?: number)
    • #demote(item: T / predicate: (T) => boolean, slots?: number)
    • #promoteToStart(item: T / predicate: (T) => boolean)
    • #demoteToEnd(item: T / predicate: (T) => boolean)

New Features

  • xjs.Map.tee now allows a comparator predicate for key equality
    xjs.Map.tee(my_map, my_key, my_value, (key1, key2) => Object.is(key1, key2));
    

Fixes

v0.26.0

Choose a tag to compare

@chharvey chharvey released this 11 Apr 02:57

Breaking

  • require Node v18+
  • remove string parameters from {BigInt,Number}#assertType

Non-Breaking

  • using eslint internally
  • new method xjs.Map.forEachAggregated, analogous to xjs.Array.forEachAggregated
  • refactor some methods to improve safety

New Data Structures

  • LinkedList
  • Queue
  • Max Binary Heap

Fixes

  • fix issue where xjs.Map.is wasn’t using the comparison predicates

v0.25.0

Choose a tag to compare

@chharvey chharvey released this 10 Jul 23:49
  • new Array static methods:
    • xjs_Array.forEachAggregated: like .forEach but catches and aggregates errors, and runs until the end of the array
    • xjs_Array.mapAggregated: like .map but catches and aggregates errors, and runs until the end of the array
  • new Set static methods:
    • xjs_Set.has
    • xjs_Set.add
    • xjs_Set.delete
  • new Map static methods:
    • xjs_Map.has
    • xjs_Map.get
    • xjs_Map.set
    • xjs_Map.delete
  • updated Set static methods, taking optional comparator parameter:
    • xjs_Set.union
    • xjs_Set.intersection
    • xjs_Set.difference
    • xjs_Set.symmetricDifference
  • node v16+ required

v0.24.1

Choose a tag to compare

@chharvey chharvey released this 23 Jun 05:22
  • upgrade deps & address security vulns

v0.24.0

Choose a tag to compare

@chharvey chharvey released this 04 Jul 04:39

Fixes

  • fix issue where constructing a MapEq with multiple entries would result in an error
  • fix type-checking of tests

O/M

  • update deps
  • add more MapEq tests

New Features

  • add MapEq#delete

v0.23.1

Choose a tag to compare

@chharvey chharvey released this 10 Jun 01:47
  • convert gulp scripts to npm scripts
  • update build output
  • update dependencies
  • node v14+ required

Important:
The peerDependency of typescript >= 3.8.0 has been removed, so if you’re using TypeScript in your project, you can use lower versions. However, TS files in this project use features in 4.3+, for example, import type ... and the override keyword. This means in your tsconfig you should set:

"compilerOptions": {
  ...
  "skipLibCheck": true
}

v0.23.0

Choose a tag to compare

@chharvey chharvey released this 10 Jun 02:09

DEPRECATED

critical fix in v0.23.1

v0.22.0

Choose a tag to compare

@chharvey chharvey released this 02 May 17:09
  • add template literal tag function xjs.String.dedent
  • add xjs.Map.tee
  • new class MapEq — uses a custom comparator function to determine unique keys
  • update deps
  • reorganize package.json, adding "files" field

v0.21.1

Choose a tag to compare

@chharvey chharvey released this 08 Aug 02:46

v0.21.0

Choose a tag to compare

@chharvey chharvey released this 19 Apr 06:15

Breaking

  • type-only imports (import type …)
  • add support for new native primitive type bigint (Requires "target": "ES2020" or later in tsconfig):
    • xjs.Object.typeOf
    • xjs.BigInt.assertType
    • xjs.Math.mod
    • xjs.Math.minBigInt
    • xjs.Math.maxBigInt
    • xjs.Math.clampBigInt

Non-Breaking

  • new enum NumericType, describing types of numbers. Members include INTEGER, POSITIVE, FINITE, etc.
  • the methods xjs.{Number,BigInt}.assertType take a member of enum NumericType as its second parameter. Strings are still allowed, but deprecated: a warning will be logged to the console.
    xjs.Number.assertType(42, 'integer'); // before (will log a warning)
    xjs.Number.assertType(42, NumericType.INTEGER); // after
  • update dependencies, including TypeScript v3.8.x
  • all-new testing system with Mocha
  • replace jsdoc @param <T> with @typeparam T
  • fixup 713b865 for Map