Changelog
All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
8.0.0
💥 BREAKING CHANGES
- Minimum supported Node version is v14.18; we’re dropping v12 support
7.1.0
✨ Features
7.0.0
✨ Features
- migrate to ES Modules (8c9d95d)
💥 BREAKING CHANGES
- programs now are in ES Modules and won’t work with Common JS
require()
6.1.0
✨ Features
- config file based major bump blacklisting (e15f9bb)
6.0.15
⏪ Reverts
- Revert “chore: setup refresh” (23cf206)
6.0.1
🔧 Fixed
- add
testStats
to npmignore (f3c84e9)
6.0.0
Rewrote in TypeScript and simplified the API.
BREAKING CHANGES:
- Default is not exported any more. Consume destructured:
import { extract } from “string-extract-class-names”
- Result now returns both string and index ranges:
import { extract, version } from “string-extract-class-names”;
const res = extract(“div.first-class.second-class”);
console.log(res);
// => {
// res: [".first-class”, “.second-class”],
// ranges: [
// [3, 15],
// [15, 28],
// ],
// }
What was the default output is now under plain object’s key res
.
When program exports a plain object, more goodies can be bundled, like current version or defaults.
Equally, when a plain object is exported, different flavours of output can be included. Also, there’s headroom for various stats and logs under different keys, in the same output’s plain object.
5.10.0
Accidental version bump during migration to SourceHut. Sorry about that.
5.9.0
✨ Features
- extract class and id names from bracket notation (11032db)
5.8.0
- Various documentation and setup tweaks after we migrated to monorepo
- Setup refresh: updated dependencies and all config files using automated tools
5.2.0
- Complete rewrite, now allowing to request array of ranges as well. Removed all deps. (4d888dc)
5.1.0
- Updated all dependencies
- Restored coveralls.io reporting
- Restored unit test linting
5.0.0
- Complete rewrite. Now instead of using regexes and string
replace
, we traverse the input string once and compile the array of selectors - Second argument as
true
will force the application to return arrays of ranges for each selector instead of values as strings - Removed all dependencies (all of them
lodash
) - Doubled the unit tests count — one unit test for a regular result (array of strings) and one unit test for result serving ranges
- Unit test code coverage stays at 100%
4.3.0
- Set up Rollup to remove comments from the code
4.2.0
GitHub sold us out. In the meantime, we:
- Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
- Dropped BitHound (RIP) and Travis
4.1.0
- Set up Prettier on a custom ESLint rule set.
- 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 — there’s no need to comment-outconsole.log
statements or care about them not spilling into production. Now it’s done automatically. - Unit tests are pointing at ES modules build, which means that code coverage is correct now, without Babel functions being missed. This is important because now code coverage is real again and now there are no excuses not to perfect it.
4.0.0
- Rebased in ES Modules
- Now using Rollup to serve three builds: CommonJS, UMD and ES Modules
No API changes, but bumping major just in case.
3.4.0
- Relaxed the requirements and made single character selector names to pass.
3.3.0
- Recognises
\n
,\t
and other escaped JS characters - Doesn’t extract empty classes and id’s (
.
and#
) - Doesn’t extract any classes or id’s that are one character long
3.2.0
- Readme updates
3.1.0
- Standard JS precommit hooks to enforce code style
3.0.0
Algorithm change.
v.2.0.0 — 2016-11-09
Change 1.
Breaking changes — instead of giving the first class or id as string, now we’re outputting the array of them:
Previously:
extract(“div.class-one.class-two a[target=_blank]", “#");
// => ‘.class-one’
extract(“div#id.class a[target=_blank]", “#");
// => ‘#id’
Now:
extract(“div#id.class a[target=_blank]", “#");
// => ['#id’, ‘.class’]
Once the space is encountered, there won’t be any more additions to the array.
Change 2.
There is no second argument any more, to choose between id’s or classes. Since array can contain a mix of classes and id’s, it’s unpractical to impose any other restrictions upon user any more.
This library will detect the first clump of class(es)/array(s), will put each into an array, discarding everything else around.