unprint 0.10.11 → 0.10.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/app.js +5 -1
package/README.md CHANGED
@@ -24,14 +24,14 @@ For optimal flexibility, unprint query methods can be used with or without initi
24
24
  Both `unprint.get()` and `unprint.init()` return its `query` methods pre-initialized, removing the element argument in favor of the element retrieved or received. Initialized query methods therefore will *not* accept a custom element, usually expecting the selector as the first argument instead.
25
25
 
26
26
  ```javascript
27
- const result = await unprint.get('http://localhot:3101/html');
27
+ const result = await unprint.get('http://localhost:3101/html');
28
28
  const { query } = result.context;
29
29
 
30
30
  query.element('h1#title'); // HTMLHeadingElement
31
31
  ```
32
32
 
33
33
  ```javascript
34
- const result = await fetch('http://localhot:3101/html');
34
+ const result = await fetch('http://localhost:3101/html');
35
35
  const body = await res.text();
36
36
  const { query } = await unprint.init(body);
37
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.10.11",
3
+ "version": "0.10.12",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {
package/src/app.js CHANGED
@@ -184,7 +184,11 @@ function queryAttributes(context, selector, attribute, customOptions) {
184
184
  function queryDataset(context, selector, dataAttribute, customOptions) {
185
185
  const target = queryElement(context, selector, customOptions);
186
186
 
187
- return target.dataset[dataAttribute];
187
+ if (target) {
188
+ return target.dataset[dataAttribute];
189
+ }
190
+
191
+ return null;
188
192
  }
189
193
 
190
194
  function queryDatasets(context, selector, dataAttribute, customOptions) {