@oscarpalmer/mora 0.20.0 → 0.21.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/dist/mora.full.js +8 -2
- package/dist/value/array.cjs +8 -2
- package/dist/value/array.js +8 -2
- package/package.json +1 -1
- package/src/value/array.ts +12 -2
- package/types/helpers/is.d.cts +1 -0
- package/types/helpers/proxy.d.cts +1 -0
- package/types/index.d.cts +1 -0
- package/types/value/array.d.cts +1 -0
- package/types/value/array.d.ts +1 -0
package/dist/mora.full.js
CHANGED
|
@@ -419,8 +419,14 @@ class ReactiveArray extends Reactive {
|
|
|
419
419
|
map(callback) {
|
|
420
420
|
return computed(() => this.get().map(callback));
|
|
421
421
|
}
|
|
422
|
-
peek(
|
|
423
|
-
|
|
422
|
+
peek(value) {
|
|
423
|
+
if (value === true) {
|
|
424
|
+
return this.#size.peek();
|
|
425
|
+
}
|
|
426
|
+
if (typeof value === 'number') {
|
|
427
|
+
return this.state.value.at(value);
|
|
428
|
+
}
|
|
429
|
+
return [...this.state.value];
|
|
424
430
|
}
|
|
425
431
|
/**
|
|
426
432
|
* Remove and return the last item of the array
|
package/dist/value/array.cjs
CHANGED
|
@@ -76,8 +76,14 @@ class ReactiveArray extends value_reactive.Reactive {
|
|
|
76
76
|
map(callback) {
|
|
77
77
|
return value_computed.computed(() => this.get().map(callback));
|
|
78
78
|
}
|
|
79
|
-
peek(
|
|
80
|
-
|
|
79
|
+
peek(value) {
|
|
80
|
+
if (value === true) {
|
|
81
|
+
return __privateGet(this, _size).peek();
|
|
82
|
+
}
|
|
83
|
+
if (typeof value === "number") {
|
|
84
|
+
return this.state.value.at(value);
|
|
85
|
+
}
|
|
86
|
+
return [...this.state.value];
|
|
81
87
|
}
|
|
82
88
|
/**
|
|
83
89
|
* Remove and return the last item of the array
|
package/dist/value/array.js
CHANGED
|
@@ -74,8 +74,14 @@ class ReactiveArray extends Reactive {
|
|
|
74
74
|
map(callback) {
|
|
75
75
|
return computed(() => this.get().map(callback));
|
|
76
76
|
}
|
|
77
|
-
peek(
|
|
78
|
-
|
|
77
|
+
peek(value) {
|
|
78
|
+
if (value === true) {
|
|
79
|
+
return __privateGet(this, _size).peek();
|
|
80
|
+
}
|
|
81
|
+
if (typeof value === "number") {
|
|
82
|
+
return this.state.value.at(value);
|
|
83
|
+
}
|
|
84
|
+
return [...this.state.value];
|
|
79
85
|
}
|
|
80
86
|
/**
|
|
81
87
|
* Remove and return the last item of the array
|
package/package.json
CHANGED
package/src/value/array.ts
CHANGED
|
@@ -112,13 +112,23 @@ export class ReactiveArray<Item> extends Reactive<Item[], Item> {
|
|
|
112
112
|
*/
|
|
113
113
|
peek(): Item[];
|
|
114
114
|
|
|
115
|
+
peek(index: number): Item | undefined;
|
|
116
|
+
|
|
115
117
|
/**
|
|
116
118
|
* Get the length of the array _(without reactivity)_
|
|
117
119
|
*/
|
|
118
120
|
peek(length: true): number;
|
|
119
121
|
|
|
120
|
-
peek(
|
|
121
|
-
|
|
122
|
+
peek(value?: unknown): unknown {
|
|
123
|
+
if (value === true) {
|
|
124
|
+
return this.#size.peek();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (typeof value === 'number') {
|
|
128
|
+
return this.state.value.at(value);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return [...this.state.value];
|
|
122
132
|
}
|
|
123
133
|
|
|
124
134
|
/**
|
package/types/helpers/is.d.cts
CHANGED
package/types/index.d.cts
CHANGED
package/types/value/array.d.cts
CHANGED
package/types/value/array.d.ts
CHANGED