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
0
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 9.1.1 to 9.2.0

9

index.d.ts

@@ -40,2 +40,9 @@ import type { ParseSelector } from 'typed-query-selector/parser.js';

declare function $$<Selected extends Element = HTMLElement>(selectors: string | readonly string[], baseElements?: BaseElements): Selected[];
export { $, $$, lastElement, elementExists, expectElement };
/**
* @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
*/
declare function expectElements<Selector extends string, Selected extends Element = ParseSelector<Selector, HTMLElement>>(selectors: Selector | readonly Selector[], baseElements?: BaseElements): Selected[];
declare function expectElements<Selected extends Element = HTMLElement>(selectors: string | readonly string[], baseElements?: BaseElements): Selected[];
export { $, $$, lastElement, elementExists, expectElement, expectElements };

@@ -65,2 +65,13 @@ // Type predicate for TypeScript

}
export { $, $$, lastElement, elementExists, expectElement };
function expectElements(selectors, baseElements) {
// Shortcut with specified-but-null baseElements
if (arguments.length === 2 && !baseElements) {
throw new ElementNotFoundError('Expected elements not found because the base is specified but null');
}
const elements = $$(selectors, baseElements);
if (elements.length > 0) {
return elements;
}
throw new ElementNotFoundError(`Expected elements not found: ${String(selectors)}`);
}
export { $, $$, lastElement, elementExists, expectElement, expectElements };

2

package.json
{
"name": "select-dom",
"version": "9.1.1",
"version": "9.2.0",
"description": "Extra lightweight DOM selector helper",

@@ -5,0 +5,0 @@ "keywords": [

@@ -80,6 +80,10 @@ # select-dom [![][badge-gzip]][link-npm] [![npm downloads][badge-downloads]][link-npm]

```ts
import {$, $optional} from 'select-dom/strict.js';
import {$, $optional, $$, $$optional} from 'select-dom/strict.js';
const must: HTMLAnchorElement = $('.foo a[href=bar]'); //
const optional: HTMLAnchorElement | undefined = $optional('.foo a[href=bar]');
const oneOrMore: HTMLAnchorElement[] = $$('.foo a[href=bar]'); //
const zeroOrMore: HTMLAnchorElement[] = $$optional('.foo a[href=bar]');
```

@@ -86,0 +90,0 @@

@@ -1,1 +0,1 @@

export { $ as $optional, expectElement as $ } from './index.js';
export { $ as $optional, $$ as $$optional, expectElement as $, expectElements as $$, } from './index.js';

@@ -1,1 +0,1 @@

export { $ as $optional, expectElement as $ } from './index.js';
export { $ as $optional, $$ as $$optional, expectElement as $, expectElements as $$, } from './index.js';
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