Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nth-check

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nth-check

Parses and compiles CSS nth-checks to highly optimized functions.

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27M
decreased by-5.06%
Maintainers
1
Weekly downloads
 
Created

What is nth-check?

The nth-check package is a utility for parsing and evaluating CSS nth-expressions, such as those used in :nth-child or :nth-of-type pseudo-classes. It allows developers to determine if an element is the nth child of its parent based on the given nth-expression.

What are nth-check's main functionalities?

Parsing nth-expressions

This feature allows for parsing a CSS nth-expression and returns a function that can be used to check if a given index matches the nth-expression.

const nthCheck = require('nth-check');
const check = nthCheck('2n+3');
console.log(check(5)); // true

Evaluating nth-expressions

This feature evaluates whether a given index (like the position of an element among its siblings) matches the nth-expression, such as 'odd' or 'even'.

const nthCheck = require('nth-check');
const check = nthCheck('odd');
console.log(check(1)); // true
console.log(check(2)); // false

Other packages similar to nth-check

Keywords

FAQs

Package last updated on 23 May 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc