https://github.com/heapwolf/qs
A minimalist dom library
https://github.com/heapwolf/qs
Last synced: about 1 month ago
JSON representation
A minimalist dom library
- Host: GitHub
- URL: https://github.com/heapwolf/qs
- Owner: heapwolf
- Created: 2018-06-22T10:45:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-12T15:47:28.000Z (over 6 years ago)
- Last Synced: 2025-03-18T12:51:02.345Z (2 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SYNOPSIS
A minimal query selector helper library.# INSTALL
```bash
npm install heapwolf/qs
```# API
There are only two methods, `qs` and `qsa`.`qs` is a short function that assumes document, but can take an optional
additional parameter that will specify scope of the selector's execution.```js
const qs = (s, p) => (p || document).querySelector(s)
````qsa` is the same as above, but uses `.querySelectorAll` and will also
convert the NodeList into an array, providing at least an empty array if
there are no nodes found.```js
const qsa = (s, p) => [...(p || document).querySelectorAll(s)]
``````js
module.exports = { qs, qsa }
```