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
Strings.notNullOrEmpty()
andnotNullOrWhiteSpace()
Arrays.findMatchingProps()
overload to ensure non-null array is returned when input 'ary' is not nullArrays.firstProp()
overload to ensure non-null value is returned when input 'ary' is not null and 'ensureOne' is true
Arrays.firstProp()
ensureOne
parameter not working correctly, added unit test
0.22.0 - 2022-01-02
- Update to TypeScript 4.4
0.21.2 - 2021-08-11
Arrays.groupBy()
which maps an array to a map of arrays grouped by a property name- Add optional
throwIfDuplicates
parameter toArrays.toMap()
the default value istrue
which may be a breaking change for some
- 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
- Modify
Arrays.diffPartsCustomEquality()
to accept different types forary1
andary2
0.21.0 - 2021-06-12
- Update to TypeScript 4.3
0.20.1 - 2020-12-10
- Expand
Arrays.max()
,min()
,maxValueIndex()
,minValueIndex()
ary
parameters to acceptnull
andundefined
in the input array Arrays.max()
,min()
,maxValueIndex()
,minValueIndex()
no longer treatnull
as zero
0.20.0 - 2020-09-04
- Update to TypeScript 4.0
0.19.2 - 2020-05-08
- Chrome throwing 'not a function' error when calling
Array.prototype
function reference.
0.19.1 - 2019-11-09
- Adjusted
Arrays.toMap()
code to compile in other projects whents-mortar
is included as a library
0.19.0 - 2019-11-08
Arrays.toMap()
which maps an array to an object/map using a specific property of each object as the key- Added optional
distinct
parameter toArrays.pluck()
- Renamed
Arrays.unique()
->Arrays.distinct()
0.18.2 - 2019-11-08
- Update to TypeScript 3.7
0.18.1 - 2019-08-09
- Added
Numbers.toFixed()
implementation that correctly rounds (JavaScriptNumber.toFixed()
doesn't round certain decimal values ending with '5' correctly)
Numbers.roundTo()
bug with certain decimal values ending with '5' (using newtoFixed()
implementation)Numbers.format()
andNumbers.formatNumeric()
to use the newtoFixed()
implementation
0.18.0 - 2019-06-17
- Renamed
Arrays.hasItems()
->hasAny()
- Renamed
Strings.clamp()
->truncate()
- Unit tests cleanup
- Update to TypeScript 3.5
0.17.0 - 2019-05-17
Arrays.diffPartsCustomEquality()
for custom array symmetric difference calculating
Arrays.diff()
has an additional optional 'equal' function parameter to allow for custom equality when comparing arrays- Arrays changed several '[]' parameter types to 'ArrayLike<...>'
Arrays.copy()
since.slice()
is preferred and faster in most JS environments
Arrays.splice()
bug when removing items without inserting any
0.16.1 - 2019-03-18
Objects.valuesNotNull()
parameter types improved to matchObjects.values()
0.16.0 - 2019-03-13
- Renamed
Objects.extend()
->Objects.extendPrototype()
Strings.padStart()
andStrings.padEnd()
now useString.prototype.repeat
internally which may not be available on older platforms without a polyfill. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat#Polyfill
- Removed
Objects.getProps()
, useObjects.values()
instead - Removed
Numbers.getNullableNumeric()
andNumbers.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-inString.prototype.endsWith
or a polyfill on older platforms, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith#Polyfill
Strings.isDigit()
no longer returns true for empty strings sinceparseFloat("")
returnsNaN
0.15.11 - 2019-01-30
- Documentation better matches jsdoc syntax
- Fix
Arrays.splice()
not copying input array properly whencopyToNewAry
istrue
0.15.10 - 2018-12-29
- Update to TypeScript 3.2 and fix compile errors
- Update dev dependencies and @types
- Fix
Arrays.splice()
not handling null 'origAry' and 'insertAry' parameters
0.15.9 - 2018-11-05
- Fix
Functions.lazyField()
issue with initializer functions which return null
0.15.8 - 2018-10-14
- 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
- Added release tarball and npm script
build-package
to package.json referencing external process to generate tarball
0.15.6 - 2018-04-02
- Update tsconfig.json with
noImplicitReturns: true
andforceConsistentCasingInFileNames: true
0.15.5 - 2018-03-29
- Update to TypeScript 2.8
- Added optional
propName
parameter toArrays.unique()
0.15.4 - 2018-03-01
- Added
offset
parameter toArrays.indexOfProp()
to allow searching the array starting at an offset. Same behavior as Array.indexOf(T, number).
0.15.3 - 2018-02-28
- Update to TypeScript 2.7
- Update dependencies: mocha, @types/chai, @types/mocha, @types/node
- Enable tsconfig.json
noImplicitAny
0.15.2 - 2018-01-08
- Updated README.md
- Fix issue with Strings.clamp() handling empty and whitespace strings
0.15.1 - 2017-11-16
- Fixed some minor issues with TypeScript null types depending on compiler version
0.15.0 - 2017-10-28
- Added
strictNullChecks
totsconfig.json
and updated code to handle null types
String.padZeroLeft(str, len)
sincepadLeft(str, len, '0')
is the same number of characters
0.14.3 - 2017-08-18
Numbers.isNumeric()
return type changed back toboolean
fromn is number
since that was incorrectNumbers.getNullableNumeric()
accepts a 2nd, optional,decimalPlaces
parameter- Updated Numbers unit tests
0.14.2 - 2017-08-05
- Update to TypeScript 2.4
0.14.1 - 2017-06-18
- Improved Objects.assignAll() type definition
0.14.0 - 2017-06-18
- Tightened parameter types
- Updated some documentation
- 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
- Updated to TypeScript 2.3.0 and @types definitions
0.13.1 - 2017-04-05
- Added Arrays.sum()
0.13.0 - 2017-03-21
- Renamed Strings padZeroLeft() -> padZeroStart(), padLeft() -> padStart(), and padRight() -> padEnd() to align with new JS spec
- 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
- Arrays.count() and cleaned up ArraysTest cases
0.12.0 - 2017-01-22
Major changes to use new TypeScript 2.0 features
- 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
Minor changes for TypeScript 2.0 compatibility
0.11.0 - 2016-09-19
- Updated 'q' and 'mocha' dependencies to latest versions
- Moved events/ to separate ts-event-handlers-lite library
0.10.2 - 2016-09-19
- Adjusted padLeft() and padRight() corner case to skip unnecessarily working with an empty array
- Refactored Strings unit tests
0.10.1 - 2016-09-17
- 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 DateTimes - moved to new ts-date-times library
0.9.2 - 2016-08-23
- Objects cloneNonUndefined() and assignNonUndefined()
- 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 enum-creator.d.ts with EnumType and EnumMember interfaces
- Moved EnumType and EnumMember interfaces from EnumCreator to enum-creator.d.ts
0.9.0 - 2016-06-07
- Functions.partial() as a general replacement for wrap*Arg() functions
- Added Functions.lazyField return function optional 'refetch' parameter
- 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
- Arrays.removeAll()
- Remove {@code } blocks in documentation, since this is a javadoc style and Visual Studio doesn't parse it leading to ugle documentation preview snippets
- 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
- Renamed Arrays.diff() -> diffParts()
- Renamed Arrays.looseDiff() -> diff()
- Switched unit testing library from qunit to chai and mocha
0.7.3 - 2016-05-27
- 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
- EnumCreator.initEnumClass() return signature improved and added optional memberVisitor parameter
- Renamed EnumCreator EnumConstantImpl -> EnumMemberImpl
0.7.1 - 2016-05-25
- EnumCreator refactored to support an easier way of creating enums
0.7.0 - 2016-05-24
- Added Array.containsAny()
- Renamed EventListenerListImpl -> EventListenerList
- Renamed EventQueueImpl -> EventQueue
- Defer and tspromises.d.ts have moved to the new ts-promises library
0.6.0 - 2016-05-06
- Added Objects.clone() support for Date and primitives
- Arrays.clear() now uses ES5 'ary.length = 0' syntax
- Removed Objects.getProp() since it serves little purpose
0.5.5 - 2016-04-27
- Fixed Objects.cloneDeep() bug copying strings
0.5.4 - 2016-04-21
- 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
- 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
- Renamed Objects cloneMap() -> map(), map now returns null when 'source' is null rather than throwing an error
0.5.2 - 2016-04-19
- Objects.cloneDeep() support for Date type
0.5.1 - 2016-04-18
- Improved Objects.cloneMap() overloaded virtual TypeScript signatures
0.5.0 - 2016-04-18
- Objects.cloneMap() similar to assign() or clone(), but designed to copy maps (containing properties all of the same type) using a property clone function
- Objects.coalesce() too general and found to rarely be used this way in practice
0.4.5 - 2016-04-16
A CHANGELOG.md covering all previous releases after being reminded about the need for change logs from http://keepachangelog.com/
- 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
- 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
- Added Objects.assign() TypeScript overloads to return a type more specific than 'any' when possible
0.4.3 - 2016-04-14
- 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
- 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
- Arrays.equal() and test cases
- Simplified some of the DateTimes test cases' names
- Old .js test files that were forgotten after test files were renamed with *Test suffix
0.4.0 - 2016-03-29
- Arrays max() and min() for numeric arrays
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
- Objects.invert() and test cases
0.3.9 - 2016-02-17
- Functions wrap1Arg(), wrap2Arg(), and wrap3Arg() functions that creates a function that calls another function with baked in arguments
0.3.8 - 2016-01-30
- Arrays isOneItem() and getIfOneItem() and test cases
0.3.7 - 2016-01-22
- Objects.extend() to support get and set properties using Object.defineProperty()
0.3.6 - 2015-12-22
- Arrays.swap() and test cases
0.3.5 - 2015-12-18
- EnumCreator test cases
- Added Objects.extend() 'deepExtend' flag
- 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 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
- 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 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
- Strings.clamp() to chop string to a max length and test cases
Added comments back to compiled .js files
0.3.1 - 2015-11-13
Renamed /tsDefinitions/ -> /definitions/ folder for .d.ts files
Did not commit '.d.ts' files, since these are just files copied from the DefinitelyTyped project
0.3.0 - 2015-11-13
- Renamed Arrays spliceArray() -> splice()
0.2.0 - 2015-11-10
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
- Narrowed Objects.values() parameter types
0.1.0 - 2015-11-7
- qunit tests for utils/Objects and date-time/DateTimes
- 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()
- Objects.orNull() because it's so simple to type 'value != null ? value : null' or even 'value || null'
0.0.3 - 2015-11-6
Added EnumCreator.initEnumClass() strongly typed function parameters
Old unused Dates.js file that was accidential commited
0.0.2 - 2015-11-6
- 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
Renamed project folder from TsMortar -> ts-mortar
0.0.1 - 2015-11-05
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