@ditojs/utils 2.47.0 → 2.49.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.49.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dito.js Utility Functions – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
|
|
6
6
|
"repository": "https://github.com/ditojs/dito/tree/master/packages/utils",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"typescript": "^5.8.3"
|
|
36
36
|
},
|
|
37
37
|
"types": "types",
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "8276ff1db64a82c03e1569e2403f378b0201ea3c"
|
|
39
39
|
}
|
package/src/base/base.js
CHANGED
package/src/class/mixin.test.js
CHANGED
|
@@ -5,14 +5,14 @@ describe('mixin()', () => {
|
|
|
5
5
|
function() {}
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const Something1Mixin = mixin(
|
|
9
9
|
Class =>
|
|
10
10
|
class extends Class {
|
|
11
11
|
function1() {}
|
|
12
12
|
}
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const Something2Mixin = mixin(
|
|
16
16
|
Class =>
|
|
17
17
|
class extends Class {
|
|
18
18
|
function2() {}
|
|
@@ -20,14 +20,14 @@ describe('mixin()', () => {
|
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
it('should apply mixin to class', () => {
|
|
23
|
-
const NewClass =
|
|
23
|
+
const NewClass = Something1Mixin(SomeClass)
|
|
24
24
|
const instance = new NewClass()
|
|
25
25
|
expect(instance.function).toBeInstanceOf(Function)
|
|
26
26
|
expect(instance.function1).toBeInstanceOf(Function)
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
it('should apply multiple mixins to class', () => {
|
|
30
|
-
const NewClass =
|
|
30
|
+
const NewClass = Something2Mixin(Something1Mixin(SomeClass))
|
|
31
31
|
const instance = new NewClass()
|
|
32
32
|
expect(instance.function).toBeInstanceOf(Function)
|
|
33
33
|
expect(instance.function1).toBeInstanceOf(Function)
|
|
@@ -35,14 +35,14 @@ describe('mixin()', () => {
|
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
it('should not apply mixin more than once', () => {
|
|
38
|
-
const NewClass1 =
|
|
39
|
-
const NewClass2 =
|
|
38
|
+
const NewClass1 = Something1Mixin(SomeClass)
|
|
39
|
+
const NewClass2 = Something1Mixin(NewClass1)
|
|
40
40
|
expect(NewClass2).toBe(NewClass1)
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
it('should not affect the base class', () => {
|
|
44
|
-
const NewClass1 =
|
|
45
|
-
const NewClass2 =
|
|
44
|
+
const NewClass1 = Something1Mixin(SomeClass)
|
|
45
|
+
const NewClass2 = Something2Mixin(SomeClass)
|
|
46
46
|
|
|
47
47
|
const instance = new SomeClass()
|
|
48
48
|
const instance1 = new NewClass1()
|
|
@@ -62,9 +62,9 @@ describe('mixin()', () => {
|
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
it(`should not apply mixin more than once, even if it was applied higher up`, () => {
|
|
65
|
-
const NewClass1 =
|
|
65
|
+
const NewClass1 = Something1Mixin(SomeClass)
|
|
66
66
|
class NewClass2 extends NewClass1 {}
|
|
67
|
-
const NewClass3 =
|
|
67
|
+
const NewClass3 = Something1Mixin(NewClass2)
|
|
68
68
|
expect(NewClass3).toBe(NewClass2)
|
|
69
69
|
})
|
|
70
70
|
})
|
package/src/object/clone.js
CHANGED
|
@@ -15,9 +15,7 @@ export function clone(value, options) {
|
|
|
15
15
|
descriptors = !enumerable,
|
|
16
16
|
transferables = null,
|
|
17
17
|
processValue = null
|
|
18
|
-
} =
|
|
19
|
-
? { processValue: options } // TODO: `callback` deprecated in December 2022.
|
|
20
|
-
: options || {}
|
|
18
|
+
} = options ?? {}
|
|
21
19
|
|
|
22
20
|
const clones = new Map()
|
|
23
21
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isArray, isPlainObject } from '../base/index.js'
|
|
2
|
-
import { deprecate } from '../function/deprecate.js'
|
|
3
2
|
import { clone } from './clone.js'
|
|
4
3
|
|
|
5
4
|
export function mergeDeeply(target, ...sources) {
|
|
@@ -9,13 +8,6 @@ export function mergeDeeply(target, ...sources) {
|
|
|
9
8
|
return target
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
export function merge(...args) {
|
|
13
|
-
deprecate(
|
|
14
|
-
'merge() is deprecated, use assignDeeply() or mergeDeeply() instead.'
|
|
15
|
-
)
|
|
16
|
-
return mergeDeeply(...args)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
11
|
export function assignDeeply(target, ...sources) {
|
|
20
12
|
for (const source of sources) {
|
|
21
13
|
target = mergeValues(target, source, true, false)
|
package/src/string/isDomain.js
CHANGED