@valkyriestudios/utils 12.41.0 → 12.41.2

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
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNeObject = exports.isNotEmptyObject = exports.isObject = exports.omit = exports.pick = exports.merge = exports.define = void 0;
3
+ exports.isNeObject = exports.isNotEmptyObject = exports.isObject = exports.scramble = exports.omit = exports.pick = exports.merge = exports.define = void 0;
4
4
  var define_1 = require("./define");
5
5
  Object.defineProperty(exports, "define", { enumerable: true, get: function () { return define_1.define; } });
6
6
  var merge_1 = require("./merge");
@@ -9,6 +9,8 @@ var pick_1 = require("./pick");
9
9
  Object.defineProperty(exports, "pick", { enumerable: true, get: function () { return pick_1.pick; } });
10
10
  var omit_1 = require("./omit");
11
11
  Object.defineProperty(exports, "omit", { enumerable: true, get: function () { return omit_1.omit; } });
12
+ var scramble_1 = require("./scramble");
13
+ Object.defineProperty(exports, "scramble", { enumerable: true, get: function () { return scramble_1.scramble; } });
12
14
  var is_1 = require("./is");
13
15
  Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return is_1.isObject; } });
14
16
  var isNotEmpty_1 = require("./isNotEmpty");
@@ -7,7 +7,7 @@ function wildcardProp(target, source, prop) {
7
7
  for (let i = 0; i < target.length; i++) {
8
8
  const t = target[i];
9
9
  const s = source[i];
10
- if (typeof t === 'object' && t !== null && typeof s === 'object' && s !== null) {
10
+ if (Object.prototype.toString.call(t) === '[object Object]' || Array.isArray(t)) {
11
11
  if (t === s)
12
12
  target[i] = { ...t };
13
13
  wildcardProp(target[i], s, prop);
@@ -22,7 +22,7 @@ function wildcardProp(target, source, prop) {
22
22
  else {
23
23
  const val = target[key];
24
24
  const s_val = source?.[key];
25
- if (typeof val === 'object' && typeof s_val === 'object' && val !== null && s_val !== null) {
25
+ if (Object.prototype.toString.call(val) === '[object Object]' || Array.isArray(val)) {
26
26
  if (val === s_val) {
27
27
  target[key] = Array.isArray(val) ? [...val] : { ...val };
28
28
  }
@@ -61,9 +61,8 @@ function standardProp(target, source, path) {
61
61
  return;
62
62
  }
63
63
  }
64
- if (target && typeof target === 'object' && path[last] in source) {
64
+ if (target && path[last] in source)
65
65
  delete target[path[last]];
66
- }
67
66
  }
68
67
  function omit(obj, keys) {
69
68
  if (Object.prototype.toString.call(obj) !== '[object Object]' ||
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scramble = scramble;
4
+ exports.default = scramble;
3
5
  function wildcardProp(target, source, prop, repl) {
4
6
  if (Array.isArray(target)) {
5
7
  for (let i = 0; i < target.length; i++) {
6
8
  const t = target[i];
7
9
  const s = source[i];
8
- if (typeof t === 'object' && t !== null && typeof s === 'object' && s !== null) {
10
+ if (Object.prototype.toString.call(t) === '[object Object]') {
9
11
  if (t === s)
10
12
  target[i] = { ...t };
11
13
  wildcardProp(target[i], s, prop, repl);
@@ -20,7 +22,7 @@ function wildcardProp(target, source, prop, repl) {
20
22
  else {
21
23
  const val = target[key];
22
24
  const s_val = source?.[key];
23
- if (typeof val === 'object' && typeof s_val === 'object' && val !== null && s_val !== null) {
25
+ if (Object.prototype.toString.call(val) === '[object Object]' || Array.isArray(val)) {
24
26
  if (val === s_val) {
25
27
  target[key] = Array.isArray(val) ? [...val] : { ...val };
26
28
  }
@@ -59,9 +61,8 @@ function standardProp(target, source, path, repl) {
59
61
  return;
60
62
  }
61
63
  }
62
- if (target && typeof target === 'object' && path[last] in source) {
64
+ if (target && path[last] in source)
63
65
  target[path[last]] = repl;
64
- }
65
66
  }
66
67
  function scramble(obj, keys, options) {
67
68
  if (Object.prototype.toString.call(obj) !== '[object Object]' ||
@@ -82,4 +83,3 @@ function scramble(obj, keys, options) {
82
83
  }
83
84
  return result;
84
85
  }
85
- exports.default = scramble;
@@ -2,6 +2,7 @@ export { define } from './define';
2
2
  export { merge } from './merge';
3
3
  export { pick } from './pick';
4
4
  export { omit } from './omit';
5
+ export { scramble } from './scramble';
5
6
  export { isObject } from './is';
6
7
  export { isNotEmptyObject } from './isNotEmpty';
7
8
  export { isNotEmptyObject as isNeObject } from './isNotEmpty';
@@ -3,7 +3,7 @@ function wildcardProp(target, source, prop) {
3
3
  for (let i = 0; i < target.length; i++) {
4
4
  const t = target[i];
5
5
  const s = source[i];
6
- if (typeof t === 'object' && t !== null && typeof s === 'object' && s !== null) {
6
+ if (Object.prototype.toString.call(t) === '[object Object]' || Array.isArray(t)) {
7
7
  if (t === s)
8
8
  target[i] = { ...t };
9
9
  wildcardProp(target[i], s, prop);
@@ -18,7 +18,7 @@ function wildcardProp(target, source, prop) {
18
18
  else {
19
19
  const val = target[key];
20
20
  const s_val = source?.[key];
21
- if (typeof val === 'object' && typeof s_val === 'object' && val !== null && s_val !== null) {
21
+ if (Object.prototype.toString.call(val) === '[object Object]' || Array.isArray(val)) {
22
22
  if (val === s_val) {
23
23
  target[key] = Array.isArray(val) ? [...val] : { ...val };
24
24
  }
@@ -57,9 +57,8 @@ function standardProp(target, source, path) {
57
57
  return;
58
58
  }
59
59
  }
60
- if (target && typeof target === 'object' && path[last] in source) {
60
+ if (target && path[last] in source)
61
61
  delete target[path[last]];
62
- }
63
62
  }
64
63
  function omit(obj, keys) {
65
64
  if (Object.prototype.toString.call(obj) !== '[object Object]' ||
@@ -3,7 +3,7 @@ function wildcardProp(target, source, prop, repl) {
3
3
  for (let i = 0; i < target.length; i++) {
4
4
  const t = target[i];
5
5
  const s = source[i];
6
- if (typeof t === 'object' && t !== null && typeof s === 'object' && s !== null) {
6
+ if (Object.prototype.toString.call(t) === '[object Object]') {
7
7
  if (t === s)
8
8
  target[i] = { ...t };
9
9
  wildcardProp(target[i], s, prop, repl);
@@ -18,7 +18,7 @@ function wildcardProp(target, source, prop, repl) {
18
18
  else {
19
19
  const val = target[key];
20
20
  const s_val = source?.[key];
21
- if (typeof val === 'object' && typeof s_val === 'object' && val !== null && s_val !== null) {
21
+ if (Object.prototype.toString.call(val) === '[object Object]' || Array.isArray(val)) {
22
22
  if (val === s_val) {
23
23
  target[key] = Array.isArray(val) ? [...val] : { ...val };
24
24
  }
@@ -57,9 +57,8 @@ function standardProp(target, source, path, repl) {
57
57
  return;
58
58
  }
59
59
  }
60
- if (target && typeof target === 'object' && path[last] in source) {
60
+ if (target && path[last] in source)
61
61
  target[path[last]] = repl;
62
- }
63
62
  }
64
63
  function scramble(obj, keys, options) {
65
64
  if (Object.prototype.toString.call(obj) !== '[object Object]' ||
@@ -80,4 +79,4 @@ function scramble(obj, keys, options) {
80
79
  }
81
80
  return result;
82
81
  }
83
- export default scramble;
82
+ export { scramble, scramble as default };
package/index.d.ts CHANGED
@@ -415,11 +415,19 @@ declare module "object/omit" {
415
415
  function omit<T extends Record<string, any>, K extends readonly (DottedKeysWithArray<T> | `*.${string}`)[]>(obj: T, keys: K): OmitFromObject<T, ExpandWildcardWithArray<T, K[number]>>;
416
416
  export { omit, omit as default };
417
417
  }
418
+ declare module "object/scramble" {
419
+ import { type DottedKeysWithArray } from "object/types";
420
+ function scramble<T extends Record<string, any>, K extends readonly (DottedKeysWithArray<T> | `*.${string}`)[]>(obj: T, keys: K, options?: {
421
+ replacement?: string;
422
+ }): T;
423
+ export { scramble, scramble as default };
424
+ }
418
425
  declare module "object/index" {
419
426
  export { define } from "object/define";
420
427
  export { merge } from "object/merge";
421
428
  export { pick } from "object/pick";
422
429
  export { omit } from "object/omit";
430
+ export { scramble } from "object/scramble";
423
431
  export { isObject } from "object/is";
424
432
  export { isNotEmptyObject } from "object/isNotEmpty";
425
433
  export { isNotEmptyObject as isNeObject } from "object/isNotEmpty";
@@ -784,10 +792,3 @@ declare module "modules/index" {
784
792
  export { PubSub } from "modules/PubSub";
785
793
  export { Scheduler } from "modules/Scheduler";
786
794
  }
787
- declare module "object/scramble" {
788
- import { type DottedKeysWithArray } from "object/types";
789
- function scramble<T extends Record<string, any>, K extends readonly (DottedKeysWithArray<T> | `*.${string}`)[]>(obj: T, keys: K, options?: {
790
- replacement?: string;
791
- }): T;
792
- export default scramble;
793
- }
package/object/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { define } from './define';
2
2
  export { merge } from './merge';
3
3
  export { pick } from './pick';
4
4
  export { omit } from './omit';
5
+ export { scramble } from './scramble';
5
6
  export { isObject } from './is';
6
7
  export { isNotEmptyObject } from './isNotEmpty';
7
8
  export { isNotEmptyObject as isNeObject } from './isNotEmpty';
@@ -12,4 +12,4 @@ import { type DottedKeysWithArray } from './types';
12
12
  declare function scramble<T extends Record<string, any>, K extends readonly (DottedKeysWithArray<T> | `*.${string}`)[]>(obj: T, keys: K, options?: {
13
13
  replacement?: string;
14
14
  }): T;
15
- export default scramble;
15
+ export { scramble, scramble as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valkyriestudios/utils",
3
- "version": "12.41.0",
3
+ "version": "12.41.2",
4
4
  "description": "A collection of single-function utilities for common tasks",
5
5
  "author": {
6
6
  "name": "Peter Vermeulen",