Releases: CGJennings/fast-ternary-string-set
Version 2.4.0
Features
The library can now be used seamlessly as either an ES6 (import
) or CommonJS (require
) module. In addition to standard tool chains, you can also load the ES6 module directly into a Web page via CDN by importing from https://unpkg.com/fast-ternary-string-set
.
These changes should be transparent to users of the library.
Version 2.3.0
Features
Adds several methods based on proposed changes to ECMAScript Set
s: filter
, map
, find
, some
, every
, reduce
, join
, addAll
, and deleteAll
.
Note that addAll
is not a new method, but this version accepts the new signature addAll(...strings: string[])
in addition to the existing signtature addAll(strings: string[], start?: number, end?: number)
. To maximize interoperabilty with Set
s , it is recommeded to use the new signature unless you are explicitly adding a subarray.
Version 2.2.0
Features
- Added
getRegexMatchesOf()
to list strings matching a regular expression (optimized to only search the relevant subtree where possible). - Added
getMatchesOf()
to list strings matching an arbitrary predicate function. It is equivalent to (but more performant than)[...set].filter(predicate)
.
Changes
- To align with proposed new methods for ECMAScript
Set
s, thesubtract()
operation has been renamed todifference()
. For compatibility,subtract()
will be retained until version 3. The behaviour of both methods is currently identical, but in futuredifference()
will be broadened to accept any iterable and not just anotherTernaryStringSet
.
Version 2.1.1
Fix
The methods equals()
, isSubsetOf()
, and isSupersetOf()
did not terminate as quickly as they should have in some cases.
Version 2.1.0
Features
- Added
getWithinEditDistance()
approximate matching (Levenshtein distance). - Added
getCompletedBy()
approximate matching (matches a suffix, to complementgetCompletionsOf()
). - When
addAll()
fails due to a bad element, the error message reports the bad index. - The
addAll()
andclear()
methods return the set to match behaviour ofadd()
. - Updated serialization format to produce smaller files; see README for format details. Backwards compatible with previous versions.
Version 2.0.0
Features
- Added
getCompletionsOf()
to find all members that start with a given string. - Added
compact()
which significantly reduces typical set sizes by sharing suffix nodes. - Constructor now takes an optional
Iterable<string>
to populate the set. - Added common set relations (
equals()
,isSubset()
,isSuperset()
). - Added common set operations (
union()
,intersect()
,subtract()
,symmetricDifference()
). - Added
toArray()
, which is equivalent to[...set]
orArray.from(set)
, but more efficient. - Serialized buffers support compacted sets and will use 16-bit branch pointers (instead of 32-bit) when possible. Backwards compatible with version 1 buffers.
Fixes
- Empty string was not passed to
forEach
callback when present in set.
Other changes
- Default
tsconfig.json
now targets ES2020. - Temporarily replaced
#private
class properties until language support catches up.
Compatibilty
Switching from version 1 to version 2 should not require changes to existing code. However, since the default configuration now targets ES2020, you may need to update your tools or build steps accordingly.
Version 1.1.0
The size()
method now runs in constant time.
Version 1.0.3
Adds additional test cases.
Fixes a bug occuring when Hamming-distance approximate matches involve an empty string.
Version 1.0.2
v1.0.2 1.0.2