@oscarpalmer/toretto 0.47.2 → 0.47.3

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.
@@ -1,6 +1,6 @@
1
1
  import { sanitizeNodes } from "./sanitize.mjs";
2
- import { isPlainObject } from "@oscarpalmer/atoms/is";
3
2
  import { getString } from "@oscarpalmer/atoms/string";
3
+ import { isPlainObject } from "@oscarpalmer/atoms/is";
4
4
  import { SizedMap } from "@oscarpalmer/atoms/sized/map";
5
5
  //#region src/html/index.ts
6
6
  function createHtml(value) {
package/dist/index.mjs CHANGED
@@ -110,18 +110,6 @@ function words(value) {
110
110
  }
111
111
  const EXPRESSION_WORDS = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
112
112
  //#endregion
113
- //#region node_modules/@oscarpalmer/atoms/dist/is.mjs
114
- /**
115
- * Is the value `undefined`, `null`, or stringified as a whitespace-only string?
116
- *
117
- * @param value Value to check
118
- * @returns `true` if the value is nullable or matches a whitespace-only string, otherwise `false`
119
- */
120
- function isNullableOrWhitespace(value) {
121
- return value == null || EXPRESSION_WHITESPACE$1.test(getString(value));
122
- }
123
- const EXPRESSION_WHITESPACE$1 = /^\s*$/;
124
- //#endregion
125
113
  //#region node_modules/@oscarpalmer/atoms/dist/string/index.mjs
126
114
  /**
127
115
  * Parse a JSON string into its proper value _(or `undefined` if it fails)_
@@ -621,7 +609,7 @@ function setElementValues(element, first, second, third, callback, style) {
621
609
  }
622
610
  }
623
611
  function updateElementValue(element, key, value, set, remove, isBoolean, json) {
624
- if (isBoolean ? value == null : isNullableOrWhitespace(value)) remove.call(element, key);
612
+ if (value == null) remove.call(element, key);
625
613
  else if (!ignoreSetAttribute(element, key)) set.call(element, key, json ? JSON.stringify(value) : getString(value));
626
614
  }
627
615
  const CSS_VARIABLE_PREFIX$1 = "--";
@@ -1,8 +1,8 @@
1
1
  import { updateProperty } from "./property.mjs";
2
2
  import { updateElementValue } from "./element-value.mjs";
3
- import { isPlainObject } from "@oscarpalmer/atoms/is";
4
3
  import { getString } from "@oscarpalmer/atoms/string";
5
4
  import { kebabCase } from "@oscarpalmer/atoms/string/case";
5
+ import { isPlainObject } from "@oscarpalmer/atoms/is";
6
6
  //#region src/internal/attribute.ts
7
7
  function badAttributeHandler(name, value) {
8
8
  if (typeof name !== "string" || name.trim().length === 0 || typeof value !== "string") return true;
@@ -1,5 +1,4 @@
1
1
  import { isAttribute } from "./attribute.mjs";
2
- import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
3
2
  import { getString } from "@oscarpalmer/atoms/string";
4
3
  import { kebabCase } from "@oscarpalmer/atoms/string/case";
5
4
  //#region src/internal/element-value.ts
@@ -35,7 +34,7 @@ function setElementValues(element, first, second, third, callback, style) {
35
34
  }
36
35
  }
37
36
  function updateElementValue(element, key, value, set, remove, isBoolean, json) {
38
- if (isBoolean ? value == null : isNullableOrWhitespace(value)) remove.call(element, key);
37
+ if (value == null) remove.call(element, key);
39
38
  else if (!ignoreSetAttribute(element, key)) set.call(element, key, json ? JSON.stringify(value) : getString(value));
40
39
  }
41
40
  const CSS_VARIABLE_PREFIX = "--";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/toretto",
3
- "version": "0.47.2",
3
+ "version": "0.47.3",
4
4
  "description": "A collection of badass DOM utilities.",
5
5
  "keywords": [
6
6
  "dom",
@@ -1,4 +1,3 @@
1
- import {isNullableOrWhitespace} from '@oscarpalmer/atoms/is';
2
1
  import {getString} from '@oscarpalmer/atoms/string';
3
2
  import {kebabCase} from '@oscarpalmer/atoms/string/case';
4
3
  import {isAttribute} from './attribute';
@@ -83,7 +82,7 @@ export function updateElementValue(
83
82
  isBoolean: boolean,
84
83
  json: boolean,
85
84
  ): void {
86
- if (isBoolean ? value == null : isNullableOrWhitespace(value)) {
85
+ if (value == null) {
87
86
  remove.call(element, key);
88
87
  } else if (!ignoreSetAttribute(element, key)) {
89
88
  set.call(element, key, json ? JSON.stringify(value) : getString(value));