Changelog
All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
7.0.0
💥 BREAKING CHANGES
- Minimum supported Node version is v14.18; we’re dropping v12 support
6.2.0
✨ Features
6.1.2
🔧 Fixed
- tweak types (275af61)
6.1.0
✨ Features
- export defaults and version (1107244)
6.0.0
✨ Features
- migrate to ES Modules (8c9d95d)
💥 BREAKING CHANGES
- programs now are in ES Modules and won’t work with Common JS
require()
5.1.0
✨ Features
- config file based major bump blacklisting (e15f9bb)
5.0.15
⏪ Reverts
- Revert “chore: setup refresh” (23cf206)
5.0.1
🔧 Fixed
- add
testStats
to npmignore (f3c84e9)
5.0.0
✨ Features
- rewrite in TS, start using named exports (8e75edf)
💥 BREAKING CHANGES
- previously you’d consume like:
import Ranges from …
— nowimport { Ranges } from …
4.0.0
Accidental version bump during migration to SourceHut. Sorry about that.
3.7.0
✨ Features
- remove couple dependencies and rebase a little bit (616b47d)
3.6.0
✨ Features
- non-breaking spaces are now retained when pushing with whitespace limiter option on (2de001d)
3.5.0
✨ Features
- improved whitespace insertion algorithm (b8c4463)
⏪ Reverts
- restores back as it was before, no changes to
opts.limitToBeAddedWhitespace
(f0b36f3)
3.4.0
✨ Features
- accept nulls among pushed values, do not throw, just do nothing (4badda3)
3.3.0
✨ Features
opts.mergeType
(7efa4db)
3.2.0
✨ Features
- Remove
check-types-mini
for perf reasons and also to reduce LernaECYCLE
warnings (50be5d8)
3.1.0
✨ Features
ranges.replace()
(f0a2de0)
2.16.0
- Various documentation and setup tweaks after we migrated to monorepo
- Setup refresh: updated dependencies and all config files using automated tools
2.13.0
- Harden the type checks just in case (106ae7a)
- Implement throw pinning in unit tests (6b8c789)
- Omit the 3rd argument when it’s equal to an empty string (343c153)
- Add
opts.limitLinebreaksCount
(55eedfa)
2.12.0
- Updated all dependencies
- Restored coveralls.io reporting
- Restored unit test linting
2.11.0
- If third argument is an empty string, now it’s being completely omitted. This is necessary for unit tests’ sanity. Otherwise, it’s impossible to
deepEqual
-match.
2.10.0
- Added
opts.limitLinebreaksCount
— this will allow double line breaks resulting in an empty row between the content lines.
2.9.0
- Rename to
ranges-push
and migrate to Bitbucket
2.8.0
- Fixed second input argument throw error message reporting. Previously, when second argument was of a wrong type, the first argument’s details were reported which caused confusion. Fixed now.
- Throw error pinning in unit tests. Otherwise we would not be able to prove this feature above is correctly implemented. Both before and after were throwing an error. The correctness is distinguished by which error exactly, (first arg’s wrong type)
THROW_ID_09
or (newly added second arg’s wrong type)THROW_ID_10
. I’d go as far as to say, if throw pinning was implemented at the beginning, this bug would not have happened.
2.7.0
Setup refresh.
- Set up Prettier
- Removed
package.lock
and.editorconfig
- Wired Rollup to remove comments from non-dev builds. This means we can now leave the
console.log
s in the source code — Rollup will remove them from production code. - Unit tests are pointing at ES modules build, which means that code coverage is correct now, without Babel functions being missed
2.6.0
- If
null
is being.push
ed, nothing happens. It won’tthrow
from now on.
2.5.0
-
Now accepts output of another slices class (its
.current()
output) as the first input argument. Now, it won’t throw an error that second argument is missing, provided the validation of the array from the 1st argument passes.In practice, I’m going to use it in string-remove-duplicate-heads-tails for example, where I there will be two-step process. Range comes in as a plausible range, then we traverse further and if further ranges are found, that plausible-one is merged into the real ranges slices array class. This merging up until now was a problem — it could only be done iterating one array and
.push
ing each range one-by-one into another slices array. -
🔧 Because of the above I had to rewrite the whole validation and error throwing part. All unit tests are the same and more were added, so there shoud not be any breaking changes.
2.4.0
opts.limitToBeAddedWhitespace
now also collapses the leading and trailing whitespace. If any chunk of leading whitespace (anything that would gettrim()
‘med) contain line break\n
, it’s turned into\n
. Otherwise, it’s turned into single space.
// does nothing to trimmed strings:
‘aaa’ => ‘aaa’
// if leading or trailing whitespace doesn’t contain \n, collapse to a single space
‘ aaa ‘ => ‘ aaa ‘
// otherwise, collapse to a single \n
‘ \n\n aaa \n\n\n ‘ => ‘\naaa\n’
2.3.0
.push
as an alias for.add
. Both do the same thing. I thought the name of this package has “push” so why there is no such method? Until now, that is.
2.2.0
- When third argument is
null
, any merged range results will have therenull
.
2.1.0
opts.limitToBeAddedWhitespace
— makes life easier when cleaning HTML. Now, chunk ranges can contain any amount of whitespace — thecurrent()
will runstring-collapse
on the to-be-inserted, third argument. Now, if there are any line breaks among the whitespace characters, the result will be a single line break instead. Basically, when this setting is active, only space or linebreak will be inserted in place of deleted range.
What this feature gives you is you can activate it and freely push chunks of string in, extracting whitespace along it and pushing it too. You don’t need to care about excessive amount of it — this library will truncate it automatically. It’s very handy when stripping strings from HTML tags for example.
2.0.0
-
Rewrite in ES modules
-
Now serving three builds: CommonJS, UMD and ES modules, all wired up to appropriate end-points on
package.json
-
If you have two ranges where second-one completely overlaps the first-one and the first has third argument, something to insert in its place, that third argument will be discarded upon merge.
Let’s say you got these two ranges:
[ [5, 6, “ “], [1, 10], ];
Previously, result would be
[1, 10, ‘ ‘]
. Now result will be[1, 10]
. This is logical, because each range should take care to consider its vicinity. If[1, 10]
came in without instructions to add something in its place, we assume this was intentional.
1.6.0
- Actually serving the transpiled version as default. Sorry about that. Now the transpiled source is wired to
package.json
main
. The proper Rollup setup (UMD, ESJ and ESM builds) is in coming next.
1.5.0
- Separated the merging function into a separate library, ranges-merge.
1.4.0
- Separated ranges sorting function into a separate library because it will be needed in Detergent.
- Replaced JS Standard with ESLint on
airbnb-base
config with two exceptions: 1. no semicolons and 2. allow plus-plus infor
-loops. For posterity JS Standard has been neglected by its maintainers, currently it’s using half-year old version of ESLint, and doesn’t tap to majority of its rules. After activating ESLint, it found some style issues that needed fixing. I like that.
1.3.0
- Transpiled version is available from the folder
/es5/
.
1.2.0
- 🔧 The input validation was not passing through the zero indexes for
.add()
because natural number checks were not including zero. Sorted now.
1.1.0
- An improvement to the algorithm which doesn’t change API: sorting and merging is now done upon querying
.current()
, not during.add()
. This guarantees maximum data precision, especially if you don’t do any.add()
after calling.current()
and processing the slices array using string-replace-slices-array.
1.0.0
- First public release