Skip to content

Latest commit

 

History

History
676 lines (473 loc) · 27.6 KB

CHANGELOG.md

File metadata and controls

676 lines (473 loc) · 27.6 KB

Change Log

All notable changes to this project will be documented in this file. This project does its best to adhere to Semantic Versioning.


0.22.1 - 2022-02-20

Added

  • Strings.notNullOrEmpty() and notNullOrWhiteSpace()

Changed

  • Arrays.findMatchingProps() overload to ensure non-null array is returned when input 'ary' is not null
  • Arrays.firstProp() overload to ensure non-null value is returned when input 'ary' is not null and 'ensureOne' is true

Fixed

  • Arrays.firstProp() ensureOne parameter not working correctly, added unit test

0.22.0 - 2022-01-02

Changed

  • Update to TypeScript 4.4

0.21.2 - 2021-08-11

Added

  • Arrays.groupBy() which maps an array to a map of arrays grouped by a property name
  • Add optional throwIfDuplicates parameter to Arrays.toMap() the default value is true which may be a breaking change for some

Fixed

  • Fix strange behavior if you passed an index less than 0 or equal to or greater than the array length to Arrays.fastRemoveIndex()

0.21.1 - 2021-07-08

Changed

  • Modify Arrays.diffPartsCustomEquality() to accept different types for ary1 and ary2

0.21.0 - 2021-06-12

Changed

  • Update to TypeScript 4.3

0.20.1 - 2020-12-10

Changed

  • Expand Arrays.max(), min(), maxValueIndex(), minValueIndex() ary parameters to accept null and undefined in the input array
  • Arrays.max(), min(), maxValueIndex(), minValueIndex() no longer treat null as zero

0.20.0 - 2020-09-04

Changed

  • Update to TypeScript 4.0

0.19.2 - 2020-05-08

Fixed

  • Chrome throwing 'not a function' error when calling Array.prototype function reference.

0.19.1 - 2019-11-09

Changed

  • Adjusted Arrays.toMap() code to compile in other projects when ts-mortar is included as a library

0.19.0 - 2019-11-08

Added

  • Arrays.toMap() which maps an array to an object/map using a specific property of each object as the key
  • Added optional distinct parameter to Arrays.pluck()

Changed

  • Renamed Arrays.unique() -> Arrays.distinct()

0.18.2 - 2019-11-08

Changed

  • Update to TypeScript 3.7

0.18.1 - 2019-08-09

Added

  • Added Numbers.toFixed() implementation that correctly rounds (JavaScript Number.toFixed() doesn't round certain decimal values ending with '5' correctly)

Fixed

  • Numbers.roundTo() bug with certain decimal values ending with '5' (using new toFixed() implementation)
  • Numbers.format() and Numbers.formatNumeric() to use the new toFixed() implementation

0.18.0 - 2019-06-17

Changed

  • Renamed Arrays.hasItems() -> hasAny()
  • Renamed Strings.clamp() -> truncate()
  • Unit tests cleanup
  • Update to TypeScript 3.5

0.17.0 - 2019-05-17

Added

  • Arrays.diffPartsCustomEquality() for custom array symmetric difference calculating

Changed

  • Arrays.diff() has an additional optional 'equal' function parameter to allow for custom equality when comparing arrays
  • Arrays changed several '[]' parameter types to 'ArrayLike<...>'

Removed

  • Arrays.copy() since .slice() is preferred and faster in most JS environments

Fixed

  • Arrays.splice() bug when removing items without inserting any

0.16.1 - 2019-03-18

Changed

  • Objects.valuesNotNull() parameter types improved to match Objects.values()

0.16.0 - 2019-03-13

Changed

Removed

  • Removed Objects.getProps(), use Objects.values() instead
  • Removed Numbers.getNullableNumeric() and Numbers.getNullableNumericPercent() since they designed for use with jquery and this library is designed for simple, platform/library agnostic use.
  • Removed Strings.endsWith() since it contained bugs with empty strings and strings containing the search string multiple times (not just at the end). Use JS built-in String.prototype.endsWith or a polyfill on older platforms, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith#Polyfill

Fixed

  • Strings.isDigit() no longer returns true for empty strings since parseFloat("") returns NaN

0.15.11 - 2019-01-30

Changed

  • Documentation better matches jsdoc syntax

Fixed

  • Fix Arrays.splice() not copying input array properly when copyToNewAry is true

0.15.10 - 2018-12-29

Changed

  • Update to TypeScript 3.2 and fix compile errors
  • Update dev dependencies and @types

Fixed

  • Fix Arrays.splice() not handling null 'origAry' and 'insertAry' parameters

0.15.9 - 2018-11-05

Fixed

  • Fix Functions.lazyField() issue with initializer functions which return null

0.15.8 - 2018-10-14

Changed

  • Update to TypeScript 3.1
  • Update dev dependencies and @types
  • Enable tsconfig.json strict and fix compile errors
  • Removed compiled bin tarball in favor of git tags

0.15.7 - 2018-04-09

Changed

  • Added release tarball and npm script build-package to package.json referencing external process to generate tarball

0.15.6 - 2018-04-02

Changed

  • Update tsconfig.json with noImplicitReturns: true and forceConsistentCasingInFileNames: true

0.15.5 - 2018-03-29

Changed

  • Update to TypeScript 2.8
  • Added optional propName parameter to Arrays.unique()

0.15.4 - 2018-03-01

Changed

  • Added offset parameter to Arrays.indexOfProp() to allow searching the array starting at an offset. Same behavior as Array.indexOf(T, number).

0.15.3 - 2018-02-28

Changed

  • Update to TypeScript 2.7
  • Update dependencies: mocha, @types/chai, @types/mocha, @types/node
  • Enable tsconfig.json noImplicitAny

0.15.2 - 2018-01-08

Changed

  • Updated README.md

Fixed

  • Fix issue with Strings.clamp() handling empty and whitespace strings

0.15.1 - 2017-11-16

Fixed

  • Fixed some minor issues with TypeScript null types depending on compiler version

0.15.0 - 2017-10-28

Changed

  • Added strictNullChecks to tsconfig.json and updated code to handle null types

Removed

  • String.padZeroLeft(str, len) since padLeft(str, len, '0') is the same number of characters

0.14.3 - 2017-08-18

Changed

  • Numbers.isNumeric() return type changed back to boolean from n is number since that was incorrect
  • Numbers.getNullableNumeric() accepts a 2nd, optional, decimalPlaces parameter
  • Updated Numbers unit tests

0.14.2 - 2017-08-05

Changed

  • Update to TypeScript 2.4

0.14.1 - 2017-06-18

Changed

  • Improved Objects.assignAll() type definition

0.14.0 - 2017-06-18

Changed

  • Tightened parameter types
  • Updated some documentation

Removed

  • Removed Objects.orEmptyString() since it doesn't save much typing
  • Removed Arrays.ArrayLike interface (since it's now native to the TypeScript ES6 lib.d.ts)
  • Removed Arrays interface: ForEachFunc, FilterFunc, MapFunc<T, R> (since these tend to obfuscate function signatures, it's preferred to manually write these types were needed)

0.13.2 - 2017-05-08

Changed

  • Updated to TypeScript 2.3.0 and @types definitions

0.13.1 - 2017-04-05

Added

  • Added Arrays.sum()

0.13.0 - 2017-03-21

Changed

  • Renamed Strings padZeroLeft() -> padZeroStart(), padLeft() -> padStart(), and padRight() -> padEnd() to align with new JS spec

Fixed

  • String pad*() issue where non-string value could be returned if its string representation length was greater than or equal to the 'targetLen' length

0.12.1 - 2017-03-02

Added

  • Arrays.count() and cleaned up ArraysTest cases

0.12.0 - 2017-01-22

Major changes to use new TypeScript 2.0 features

Changed

  • hasMatchingProperties() passes a second parameter, the property name, to the 'filter' function parameter
  • Stronger parameter types (mostly keyof changes) for:
    • Arrays: binarySearch(), findMatchingProps(), firstProp(), pluck(), hasItems(), indexOfProp(), lastIndexOfProp(), setAllProp()
    • Objects: hasAnyNonFalseyProps(), hasAnyNonNullProps(), hasNonNullProps(), hasMatchingProps(), clone(), map(), toArray()

0.11.1 - 2016-12-21

Changed

Minor changes for TypeScript 2.0 compatibility


0.11.0 - 2016-09-19

Changed

  • Updated 'q' and 'mocha' dependencies to latest versions

Removed


0.10.2 - 2016-09-19

Changed

  • Adjusted padLeft() and padRight() corner case to skip unnecessarily working with an empty array
  • Refactored Strings unit tests

0.10.1 - 2016-09-17

Changed

  • Added some (by default) redudant type casts so this library can work with ts-date-times if the built in Date class/methods are setup to return TimestampUtc instead of number

0.10.0 - 2016-08-28

Removed


0.9.2 - 2016-08-23

Added

  • Objects cloneNonUndefined() and assignNonUndefined()

Changed

  • Objects.clone() now supports an optional 'assigner' function parameter to allow the caller to override the default 'assign' implementation
  • Updated definition file paths to match DefinitelyTyped

0.9.1 - 2016-08-08

Added

  • Added enum-creator.d.ts with EnumType and EnumMember interfaces

Changed

  • Moved EnumType and EnumMember interfaces from EnumCreator to enum-creator.d.ts

0.9.0 - 2016-06-07

Added

  • Functions.partial() as a general replacement for wrap*Arg() functions

Changed

  • Added Functions.lazyField return function optional 'refetch' parameter

Removed

  • Functions wrap1Arg(), wrap2Arg(), wrap3Arg(), use Functions.partial() instead
  • Functions lazyGetter1Arg() and lazyGetter2Arg() in favor of properly scoping your cached data, since it's not intuitive to have a function which ignores it's input parameters on subsequent calls

0.8.1 - 2016-05-31

Added

  • Arrays.removeAll()

Changed

  • Remove {@code } blocks in documentation, since this is a javadoc style and Visual Studio doesn't parse it leading to ugle documentation preview snippets

Fixed

  • Added missing Q.d.ts reference to events.d.ts now that reference imported by qunit-tests.ts no longer exists

0.8.0 - 2016-05-29

Changed

  • Renamed Arrays.diff() -> diffParts()
  • Renamed Arrays.looseDiff() -> diff()
  • Switched unit testing library from qunit to chai and mocha

0.7.3 - 2016-05-27

Changed

  • EnumCreator.initEnumClass() 'memberVisitor' parameter can optionally return null/void
  • Renamed a few classes internally to match their file names

0.7.2 - 2016-05-26

Changed

  • EnumCreator.initEnumClass() return signature improved and added optional memberVisitor parameter
  • Renamed EnumCreator EnumConstantImpl -> EnumMemberImpl

0.7.1 - 2016-05-25

Changed

  • EnumCreator refactored to support an easier way of creating enums

0.7.0 - 2016-05-24

Added

  • Added Array.containsAny()

Changed

  • Renamed EventListenerListImpl -> EventListenerList
  • Renamed EventQueueImpl -> EventQueue

Removed

  • Defer and tspromises.d.ts have moved to the new ts-promises library

0.6.0 - 2016-05-06

Changed

  • Added Objects.clone() support for Date and primitives
  • Arrays.clear() now uses ES5 'ary.length = 0' syntax

Removed

  • Removed Objects.getProp() since it serves little purpose

0.5.5 - 2016-04-27

Changed

  • Fixed Objects.cloneDeep() bug copying strings

0.5.4 - 2016-04-21

Changed

  • Objects.map() 'mapFunc' callback arguments changed from (value) to (key, value)
  • Objects.map() 'mapFunc' callback can now return undefined to skip properties

0.5.3 - 2016-04-20

Added

  • Arrays.map() - to transform an array
  • Objects.toArray() - converts each of the properties in an object to a value using a mapping function and returns them as an array

Changed

  • Renamed Objects cloneMap() -> map(), map now returns null when 'source' is null rather than throwing an error

0.5.2 - 2016-04-19

Added

  • Objects.cloneDeep() support for Date type

0.5.1 - 2016-04-18

Changed

  • Improved Objects.cloneMap() overloaded virtual TypeScript signatures

0.5.0 - 2016-04-18

Added

  • Objects.cloneMap() similar to assign() or clone(), but designed to copy maps (containing properties all of the same type) using a property clone function

Removed

  • Objects.coalesce() too general and found to rarely be used this way in practice

0.4.5 - 2016-04-16

Added

A CHANGELOG.md covering all previous releases after being reminded about the need for change logs from http://keepachangelog.com/

Changed

  • Arrays.splice() 'copyToNewAry' optional parameter, corner case optimization for insertions at the beginning of an array, and clearer documentation example

0.4.4 - 2016-04-15

Added

  • Arrays firstIndex() which is used by first(), lastIndex() which is used by last(), and maxValueIndex() and minValueIndex() to augment max() and min(), and test cases

Changed

  • Added Objects.assign() TypeScript overloads to return a type more specific than 'any' when possible

0.4.3 - 2016-04-14

Fixed

  • Arrays.unique() was sorting the input array when it didn't need to, and since the input array wasn't copied before sorting, it was modifying the caller's original array

0.4.2 - 2016-04-05

Changed

  • Flattened the project folder so it wasn't inside a sub-folder of the project root and moved .d.ts definition files to separate definitions library

0.4.1 - 2016-04-04

Added

  • Arrays.equal() and test cases

Changed

  • Simplified some of the DateTimes test cases' names

Removed

  • Old .js test files that were forgotten after test files were renamed with *Test suffix

0.4.0 - 2016-03-29

Added

  • Arrays max() and min() for numeric arrays

Changed

Renamed Arrays functions:

  • getAllProp() -> pluck()
  • findAllProp() -> findMatchingProps()
  • findOneByProp() -> firstProp() and removed duplicate findProp() which had less optional parameters to customize behavior
  • findOne() -> first() and removed duplicate first() which had less optional parameters to customize behavior

0.3.10 - 2016-03-19

Added

  • Objects.invert() and test cases

0.3.9 - 2016-02-17

Added

  • Functions wrap1Arg(), wrap2Arg(), and wrap3Arg() functions that creates a function that calls another function with baked in arguments

0.3.8 - 2016-01-30

Added

  • Arrays isOneItem() and getIfOneItem() and test cases

0.3.7 - 2016-01-22

Fixed

  • Objects.extend() to support get and set properties using Object.defineProperty()

0.3.6 - 2015-12-22

Added

  • Arrays.swap() and test cases

0.3.5 - 2015-12-18

Added

  • EnumCreator test cases
  • Added Objects.extend() 'deepExtend' flag

Changed

  • Renamed test files to all file names follow the *Test suffix convention
  • Arrays.hasItems() uses type guard return type
  • Changed Objects.extendToStatic() 'allowChildToOverride' flag default value from true -> false

Fixed

  • Fixed Objects.extend() bug that wasn't obeying the 'allowChildToOverride' flag
  • Added EnumCreator flag to throw an error if an enum constant is missing

0.3.4 - 2015-12-11

Changed

  • Added optional 'keys' (string[]) parameters to clone(), assign(), and assignAll() to only assign or clone certain properties from the source object

0.3.3 - 2015-12-10

Added

  • Added Objects assign() and assignAll() for copying properties from one object to another, clone() and cloneDeep() to copy objects, and test cases

0.3.2 - 2015-11-25

Added

  • Strings.clamp() to chop string to a max length and test cases

Changed

Added comments back to compiled .js files


0.3.1 - 2015-11-13

Changed

Renamed /tsDefinitions/ -> /definitions/ folder for .d.ts files

Removed

Did not commit '.d.ts' files, since these are just files copied from the DefinitelyTyped project


0.3.0 - 2015-11-13

Changed

  • Renamed Arrays spliceArray() -> splice()

0.2.0 - 2015-11-10

Added

Simple event handlers in new /events/ sub folder, including:

  • AsyncEventListenerList.ts - a wrapper for a ListenerList that stores asynchronous listeners and contains a fireEvent() function that handles calling asynchronous listeners
  • EventListenerListImpl.ts - a list of listeners with functions for adding and removing listeners and firing events
  • EventQueueImpl.ts - allows events to be added (internally queued) and then fired immediately or at a later time
  • SigularEventHandler.ts - similar to jquery.read(), only fires once, listeners added before the event, get called when the event occurs; listeners added after the event, get called immediately
  • events.d.ts - interface definitions for EventQueue and ListenerList

0.1.1 - 2015-11-10

Changed

  • Narrowed Objects.values() parameter types

0.1.0 - 2015-11-7

Added

  • qunit tests for utils/Objects and date-time/DateTimes

Changed

  • Widened Objects values() and valuesNotNull() parameter types
  • Changed DateTimes and nested classes to modules (since they're helper functions and should never be instantiated)
  • Renamed DateTimes toDotNetJsonTimestamp() -> toDotNetJson()

Removed

  • Objects.orNull() because it's so simple to type 'value != null ? value : null' or even 'value || null'

0.0.3 - 2015-11-6

Changed

Added EnumCreator.initEnumClass() strongly typed function parameters

Removed

Old unused Dates.js file that was accidential commited


0.0.2 - 2015-11-6

Added

  • DateTimes.ts: parseDotNetJson(), toDotNetJsonTimestamp(), getDayMinutes(), toDisplayDate(), toDisplayDateTime(), dayDiff(), currentTimezoneOffsetMillis(), now(), toDate(), parseDotNetJson(), toDotNetJson(), toUtcDotNetJson(), getDayMinutes(), toDisplayDate(), toDisplayDateTime()
  • Defer.ts: newDefer(), newPromiseResolved(), newPromiseRejected(), when1(), when2(), when3(), when4(), when(), runActionForAll(), runActionForAllInSeries(), chainTo(), chainToWith(), createCachedDeferredTask(), createCachedPromiseTask()
  • Arrays filterSplit() and toBiFilterResult()
  • tspromises.d.ts

Changed

Renamed project folder from TsMortar -> ts-mortar


0.0.1 - 2015-11-05

Added

Initial commit including:

  • Arrays.ts: addAll(), addAllTransform(), asArray(), binarySearch(), concat(), containsAll(), clear(), diff(), fastRemove(), fastRemoveIndex(), findAllProp(), findProp(), findOne(), findOneByProp(), first(), getAllProp(), hasItems(), indexOfProp(), last(), lastIndexOfProp(), looseDiff(), looseEqual(), mapFilter(), mapFilterNotNull(), removeValue(), removeIndex(), setAllProp(), sortNumeric(), spliceArray(), union(), unique()
  • EnumCreator.ts: isInstance(), parse(), values(), name(), toString(), initEnumConst(), initEnumClass()
  • Functions.ts: applyFunc(), callFunc(), isFunction(), tryCatch(), lazyField(), lazyGetter1Arg(), lazyGetter2Arg(), createFuncTimer()
  • Numbers.ts: isNumeric(), toNumber(), isNullOrZero(), getNullableNumeric(), roundTo(), getNullableNumericPercent(), orZero(), format(), formatNumeric()
  • Objects.ts: values(), valuesNotNull(), hasAnyNonFalseyProps(), hasAnyNonNullProps(), hasNonNullProps(), hasMatchingProps(), coalesce(), orNull(), getProp(), getProps(), orEmptyString(), extend(), extendToStatic()
  • Strings.ts: endsWith(), isNullOrEmpty(), isNullOrWhiteSpace(), isCharAtDigit(), isDigit(), isCharAtUpperCase(), isCharAtLowerCase(), looseEqual(), padZeroLeft(), padLeft(), padRight(), removeLeading(), removeTrailing(), replaceAll()
  • qunit tests for many of these functions