help-style
v0.1.0
Published
Small js package I use to help deal with css styling
Maintainers
Readme
help-style
Small js package I use to help deal with css styling
Install
$ npm install help-styleImport
This package is pure ESM. It cannot be require()'d from CommonJS.
Use import foo from 'foo' instead of const foo = require('foo') to import the package.
// Load entire build
import * as helpStyle from 'help-style';
// Load by method
import {hasClass} from 'help-style';If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
You also need to make sure you're on the latest minor version of Node.js. At minimum Node.js 12.20, 14.14, or 16.0.
Read more here: sindresorhus/esm-package
Usage
hasClass([1,2,3], (element) => typeof element === 'string');
//=> false
hasClass(['1', '2', '3'], (element) => typeof element === 'string');
//=> truehasClass : Checks whether an element has a particular classtoggleClass : Toggle a class for an element
addClass : Add a class for an elementaddClassAll : Add a class to all elements of a NodeList
removeClass : Remove a class for an elementremoveClassAll : Remove a class to all elements of a NodeList
getStyle : Get the value of a CSS rule for an element
getCurrentMediaQuery : Returns the current media query in use
getMetaContentByName : Returns a metatag content by name
License
MIT © Paul Nodet
