New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

csset

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csset

experiment to perform algebra of sets with css

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

csset

Set operations for CSS selectors

GitHub license Issues Coverage Status Code Size Weekly downloads

Install

npm install --save csset

Requirements

Although this lib has been tested using the node's test runner it should work in all node and browser environments that support Set and template literals.

Usage

Basic

import { Csset } from 'csset';

// Create your sets
const set1 = new Csset('div > p');
const set2 = new Csset('div');
const set3 = new Csset('p');

// Make set operations
// supersetOf
console.assert(set1.supersetOf(set2) === false);
console.assert(set2.supersetOf(set1) === false);
console.assert(set3.supersetOf(set1) === true);

// subsetOf
console.assert(set1.subsetOf(set3) === true);
console.assert(set1.subsetOf(set2) === false);

// union
console.assert(set1.union(set3).toString() === 'p');
console.assert(set1.union(set2).toString() === 'div > p, div');

// intersection
console.assert(set1.intersection(set3).toString() === 'div > p');
console.assert(set1.intersection(set2) === undefined); // void means empty set

Known issues & limitations

  • As for now pseudo selectors are not supported

Roadmap

  • Support for pseudo-classes
  • consider other set operations (diff, complementary, ...)

Release notes

[0.1.1]

  • Add trusted publishers and provenance

[0.1.0]

  • BREAKING CHANGE: the package has been migrated from TypeScript to JavaScript + JsDocs for types. In this migration I've decided to make the package ESM only so require would fail to load the lib. The new flag --experimental-require-module can be used to load the lib if your app is in commonjs format. Checkout the docs.
  • Embed the parser into the lib
  • Add intersection API
  • Add empty properti to set class
  • Update demos

[0.0.10]

  • Use parsel-ts to tokenize selectors

[0.0.9]

  • Added build for ESM modules

Keywords

css

FAQs

Package last updated on 10 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts