@ptolemy2002/list-object-utils 1.1.0 → 1.2.1

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 +1 -3
  2. package/index.js +5 -12
  3. package/package.json +2 -5
package/README.md CHANGED
@@ -4,9 +4,7 @@ This is a React Library Created by Ptolemy2002's [cra-template-react-library](ht
4
4
  For now, the library makes use of React 18 and does not use TypeScript.
5
5
 
6
6
  ## Peer Dependencies
7
- These should be installed in order to use the library, as npm does not automatically add peer dependencies to your project.
8
- - @types/is-callable: ^1.1.2
9
- - is-callable: ^1.2.7
7
+ This project does not have any peer dependencies, so it should work out of the box.
10
8
 
11
9
  ## Commands
12
10
  The following commands exist in the project:
package/index.js CHANGED
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/index.js
@@ -43,7 +33,6 @@ __export(src_exports, {
43
33
  sortWithIndeces: () => sortWithIndeces
44
34
  });
45
35
  module.exports = __toCommonJS(src_exports);
46
- var import_is_callable = __toESM(require("is-callable"));
47
36
  function listsEqual(a, b) {
48
37
  if (!Array.isArray(a) || !Array.isArray(b)) return false;
49
38
  if (a === b) return true;
@@ -149,7 +138,11 @@ function objectDifference(a, b) {
149
138
  function flattenKeys(obj, prefix = "") {
150
139
  const result = {};
151
140
  for (const key in obj) {
152
- if (typeof obj[key] === "object" && !Array.isArray(obj[key])) {
141
+ if (Array.isArray(obj[key])) {
142
+ const flat = flattenKeys(obj[key], prefix + key + ".");
143
+ Object.assign(result, flat);
144
+ if (Object.keys(flat).length === 0) result[prefix + key] = obj[key];
145
+ } else if (typeof obj[key] === "object") {
153
146
  const flat = flattenKeys(obj[key], prefix + key + ".");
154
147
  Object.assign(result, flat);
155
148
  if (Object.keys(flat).length === 0) result[prefix + key] = obj[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/list-object-utils",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js"
@@ -26,10 +26,7 @@
26
26
  },
27
27
  "description": "Utilities for working with lists and objects",
28
28
  "license": "ISC",
29
- "peerDependencies": {
30
- "@types/is-callable": "~1.1.2",
31
- "is-callable": "^1.2.7"
32
- },
29
+ "peerDependencies": {},
33
30
  "devDependencies": {
34
31
  "esbuild": "^0.23.0"
35
32
  }