Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

backOpen Source→string-extract-class-names→Changelog

Changelog

All notable changes to this project will be documented in this file.
See Conventional Commits opens in a new tab for commit guidelines.

8.3.0

1 Sept 2026

🔧 Fixed

  • follow CSS selector token rules (fbf896e)
  • isolate failed attribute selectors (729ea22)

✨ Features

  • expand HTML attribute selector support (dce1556)

Performance Improvements

  • keep selector extraction linear (ae03343)

8.2.1

22 Aug 2026

Performance Improvements

  • optimise package hot paths and JSON editing (f3112bd)

8.2.0

19 Aug 2026

🔧 Fixed

  • make validation diagnostics safe (7b01074)
  • resolve various review findings (b60e9ee)
  • retire direct publish aliases (f98e31e)
  • standardise selector extraction errs (f26a8e1)

✨ Features

  • add codsen-glob and migrate glob consumers (5595a2b)
  • decode escaped CSS selector identifiers (8f4d301), closes #106
  • refresh the tooling and generate with the latest dependencies (781f802)

⏪ Reverts

  • Revert “Merge pull request #128 from codsen/release/npm-32198404552–1″ (5baeeaa), closes #128
  • Revert “Merge pull request #127 from codsen/release/npm-32194020886–1″ (5f1e94d), closes #127

8.0.0

1 Dec 2022

💥 BREAKING CHANGES

  • Minimum supported Node version is v14.18; we’re dropping v12 support

7.1.0

12 Aug 2022

✨ Features

  • export types (87f1b65)
  • export types (11b5fb9)

7.0.0

9 Sept 2021

✨ 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

24 May 2021

✨ Features

  • config file based major bump blacklisting (e15f9bb)

6.0.15

11 Apr 2021

⏪ Reverts

  • Revert “chore: setup refresh” (23cf206)

6.0.1

28 Jan 2021

🔧 Fixed

  • add testStats to npmignore (f3c84e9)

6.0.0

23 Jan 2021

Rewrote in TypeScript and simplified the API.

BREAKING CHANGES:

  1. Default is not exported any more. Consume destructured:

import { extract } from "string-extract-class-names"

  1. 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

28 Nov 2020

Accidental version bump during migration to SourceHut. Sorry about that.

5.9.0

4 Sept 2019

✨ Features

  • extract class and id names from bracket notation (11032db)

5.8.0

20 Jan 2019
  • Various documentation and setup tweaks after we migrated to monorepo
  • Setup refresh: updated dependencies and all config files using automated tools

5.2.0

26 Dec 2018
  • Complete rewrite, now allowing to request array of ranges as well. Removed all deps. (4d888dc)

5.1.0

25 Oct 2018
  • Updated all dependencies
  • Restored coveralls.io reporting
  • Restored unit test linting

5.0.0

4 Jul 2018
  • 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

29 Jun 2018
  • Set up Rollup to remove comments from the code

4.2.0

16 Jun 2018

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

26 May 2018
  • 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.logs in the source code — there’s no need to comment-out console.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

13 Dec 2017
  • 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

28 Aug 2017
  • Relaxed the requirements and made single character selector names to pass.

3.3.0

1 Jan 2017
  • 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

27 Dec 2016
  • Readme updates

3.1.0

23 Dec 2016
  • Standard JS precommit hooks to enforce code style

3.0.0

19 Nov 2016

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.

back 

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab