New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

select-dom

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

select-dom - npm Package Compare versions

Comparing version

to
7.1.0

15

index.d.ts
import type { ParseSelector } from 'typed-query-selector/parser';
declare type Parse<Selector extends string> = HTMLElement extends ParseSelector<Selector> ? HTMLElement : ParseSelector<Selector>;
declare type BaseElements = ParentNode | Iterable<ParentNode>;

@@ -8,3 +9,3 @@ /**

*/
declare function select<Selector extends string, TElement extends Element = ParseSelector<Selector>>(selectors: Selector | Selector[], baseElement?: ParentNode): TElement | undefined;
declare function select<Selector extends string, TElement extends Element = Parse<Selector>>(selectors: Selector | Selector[], baseElement?: ParentNode): TElement | undefined;
declare namespace select {

@@ -15,2 +16,8 @@ var last: typeof selectLast;

}
declare function select<TElement extends Element = HTMLElement>(selectors: string | string[], baseElement?: ParentNode): TElement | undefined;
declare namespace select {
var last: typeof selectLast;
var exists: typeof selectExists;
var all: typeof selectAll;
}
/**

@@ -21,3 +28,4 @@ * @param selectors One or more CSS selectors separated by commas

*/
declare function selectLast<Selector extends string, TElement extends Element = ParseSelector<Selector>>(selectors: Selector | Selector[], baseElement?: ParentNode): TElement | undefined;
declare function selectLast<Selector extends string, TElement extends Element = Parse<Selector>>(selectors: Selector | Selector[], baseElement?: ParentNode): TElement | undefined;
declare function selectLast<TElement extends Element = HTMLElement>(selectors: string | string[], baseElement?: ParentNode): TElement | undefined;
/**

@@ -34,3 +42,4 @@ * @param selectors One or more CSS selectors separated by commas

*/
declare function selectAll<Selector extends string, TElement extends Element = ParseSelector<Selector>>(selectors: Selector | Selector[], baseElements?: BaseElements): TElement[];
declare function selectAll<Selector extends string, TElement extends Element = Parse<Selector>>(selectors: Selector | Selector[], baseElements?: BaseElements): TElement[];
declare function selectAll<TElement extends Element = HTMLElement>(selectors: string | string[], baseElements?: BaseElements): TElement[];
export default select;

@@ -5,7 +5,2 @@ // Type predicate for TypeScript

}
/**
* @param selectors One or more CSS selectors separated by commas
* @param [baseElement] The element to look inside of
* @return The element found, if any
*/
function select(selectors, baseElement) {

@@ -19,7 +14,2 @@ var _a;

}
/**
* @param selectors One or more CSS selectors separated by commas
* @param [baseElement] The element to look inside of
* @return The element found, if any
*/
function selectLast(selectors, baseElement) {

@@ -45,7 +35,2 @@ // Shortcut with specified-but-null baseElement

}
/**
* @param selectors One or more CSS selectors separated by commas
* @param [baseElements] The element or list of elements to look inside of
* @return An array of elements found
*/
function selectAll(selectors, baseElements) {

@@ -52,0 +37,0 @@ // Shortcut with specified-but-null baseElements

99

package.json
{
"name": "select-dom",
"version": "7.0.0",
"description": "Extra lightweight DOM selector helper",
"keywords": [
"alternative",
"css",
"dom",
"elements",
"jquery",
"querySelector",
"querySelectorAll",
"selector"
],
"repository": "fregante/select-dom",
"license": "MIT",
"author": "Federico Brigante <opensource@bfred.it> (bfred.it)",
"type": "module",
"main": "index.js",
"module": "index.js",
"files": [
"index.js",
"index.d.ts"
],
"scripts": {
"build": "tsc",
"prepack": "tsc --sourceMap false",
"test": "tsc && tsd && xo && npm run tape",
"test:tape": "browserify -p esmify test.js | tape-run",
"watch": "tsc --watch"
},
"xo": {
"envs": [
"browser"
],
"rules": {
"prefer-spread": "off"
}
},
"devDependencies": {
"@sindresorhus/tsconfig": "^0.8.0",
"browserify": "^17.0.0",
"esmify": "^2.1.1",
"tape": "^5.0.1",
"tape-run": "^8.0.0",
"tsd": "^0.14.0",
"typescript": "^4.1.3",
"xo": "^0.36.1"
},
"dependencies": {
"typed-query-selector": "^2.1.0"
}
"name": "select-dom",
"version": "7.1.0",
"description": "Extra lightweight DOM selector helper",
"keywords": [
"alternative",
"css",
"dom",
"elements",
"jquery",
"querySelector",
"querySelectorAll",
"selector"
],
"repository": "fregante/select-dom",
"license": "MIT",
"author": "Federico Brigante <me@fregante.com> (https://fregante.com)",
"type": "module",
"main": "index.js",
"module": "index.js",
"files": [
"index.js",
"index.d.ts"
],
"scripts": {
"build": "tsc",
"prepack": "tsc --sourceMap false",
"test": "tsc && tsd && xo && npm run test:tape",
"test:tape": "browserify -p esmify test.js | tape-run",
"watch": "tsc --watch"
},
"xo": {
"envs": [
"browser"
]
},
"dependencies": {
"typed-query-selector": "^2.2.3"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^0.8.0",
"browserify": "^17.0.0",
"esmify": "^2.1.1",
"tape": "^5.1.0",
"tape-run": "^8.0.0",
"tsd": "^0.14.0",
"typescript": "^4.1.3",
"xo": "^0.36.1"
}
}
# select-dom [![][badge-gzip]][link-npm] [![npm downloads][badge-downloads]][link-npm]
[badge-gzip]: https://img.shields.io/bundlephobia/minzip/select-dom.svg?label=gzipped
[badge-downloads]: https://img.shields.io/npm/dt/select-dom.svg
[link-npm]: https://www.npmjs.com/package/select-dom
[badge-gzip]: https://img.shields.io/bundlephobia/minzip/select-dom.svg?label=gzipped
[badge-downloads]: https://img.shields.io/npm/dt/select-dom.svg
[link-npm]: https://www.npmjs.com/package/select-dom
> Lightweight `querySelector`/`All` wrapper that outputs an Array
Version 5+ only supports browsers with [`Set` support](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#Browser_compatibility). If you need IE 10- support, stick to [`select-dom@4`](https://github.com/fregante/select-dom/tree/v4.2.2)
Version 7+ only supports browsers with [iterable `NodeList`s](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/entries). If you need IE support, stick to [`select-dom@6`](https://github.com/fregante/select-dom/tree/v6.0.4) or lower.

@@ -22,3 +22,2 @@ ## Install

## API

@@ -33,9 +32,9 @@

```js
select('.foo a[href=bar]')
select('.foo a[href=bar]');
// => <Element>
select('.foo a[href=bar]', baseElement)
select('.foo a[href=bar]', baseElement);
// => <Element>
select('.non-existent', baseElement)
select('.non-existent', baseElement);
// => undefined

@@ -53,6 +52,6 @@ ```

```js
select.exists('.foo a[href=bar]')
select.exists('.foo a[href=bar]');
// => true/false
select.exists('.foo a[href=bar]', baseElement)
select.exists('.foo a[href=bar]', baseElement);
// => true/false

@@ -65,13 +64,13 @@ ```

* it always returns an array
* `baseElements` can be a list of elements to query
- it always returns an array
- `baseElements` can be a list of elements to query
```js
select.all('.foo')
select.all('.foo');
// => [<Element>, <Element>, <Element>]
select.all('.foo', baseElement)
select.all('.foo', baseElement);
// => [<Element>, <Element>, <Element>]
select.all('.foo', [baseElement1, baseElement2])
select.all('.foo', [baseElement1, baseElement2]);
// => [<Element>, <Element>, <Element>]

@@ -78,0 +77,0 @@ // This is similar to jQuery([baseElement1, baseElement2]).find('.foo')