@amedia/user 0.13.27 → 0.13.28

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.
package/eik.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "user",
3
- "version": "0.13.27",
3
+ "version": "0.13.28",
4
4
  "server": "https://assets.acdn.no",
5
5
  "files": {
6
6
  "user.js": "./dist/index.esm.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amedia/user",
3
- "version": "0.13.27",
3
+ "version": "0.13.28",
4
4
  "description": "Client lib for working with aID user and associated data",
5
5
  "repository": "https://github.com/amedia/amedia-user-js",
6
6
  "author": "Amedia Utvikling (ID og data)",
@@ -19,7 +19,6 @@
19
19
  "dependencies": {
20
20
  "@amedia/browserid": "^0.1.6",
21
21
  "@amedia/frontend-rpc": "^0.0.12",
22
- "deep-copy-ts": "^0.5.0",
23
22
  "runtypes": "^6.3.2",
24
23
  "ts-deepmerge": "^1.0.8"
25
24
  },
@@ -1,6 +1,26 @@
1
- import { deepCopy } from 'deep-copy-ts';
2
1
  import deepmerge from 'ts-deepmerge';
3
2
 
3
+ /** Naive implementation of deep copy needed for copying parameters when
4
+ * merging multiple calls to perform.
5
+ *
6
+ * @param obj object to copy deeply
7
+ */
8
+ function deepCopy<T>(obj: T): T {
9
+ if (typeof obj === 'string' || obj instanceof String) {
10
+ return `${obj}` as unknown as T;
11
+ }
12
+ if (obj instanceof Array) {
13
+ return [...obj].map(deepCopy) as unknown as T;
14
+ }
15
+ return Object.entries(obj).reduce(
16
+ (copy, [k, v]) => ({
17
+ ...copy,
18
+ [k]: deepCopy(v),
19
+ }),
20
+ {}
21
+ ) as T;
22
+ }
23
+
4
24
  /**
5
25
  * The Debouncer can be used when we want a clean way to say 'I want to fetch this and that, and once it's done,
6
26
  * resolve my promise', but instead of the fetch being performed right away, we want to wait for more users to