@fedify/vocab-tools 2.0.30-dev.2202 → 2.0.31-dev.2273
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/deno.json +1 -1
- package/dist/mod.cjs +6 -5
- package/dist/mod.js +6 -5
- package/package.json +1 -1
- package/src/__snapshots__/class.test.ts.deno.snap +484 -418
- package/src/__snapshots__/class.test.ts.node.snap +484 -418
- package/src/__snapshots__/class.test.ts.snap +484 -418
- package/src/constructor.ts +5 -4
package/src/constructor.ts
CHANGED
|
@@ -175,7 +175,7 @@ export async function* generateConstructor(
|
|
|
175
175
|
if (Array.isArray(values.${property.pluralName}) &&
|
|
176
176
|
values.${property.pluralName}.every(v => ${typeGuards})) {
|
|
177
177
|
// @ts-ignore: type is checked above.
|
|
178
|
-
this.${fieldName} = values.${property.pluralName};
|
|
178
|
+
this.${fieldName} = values.${property.pluralName}.slice();
|
|
179
179
|
`;
|
|
180
180
|
if (!allScalarTypes) {
|
|
181
181
|
yield `
|
|
@@ -208,7 +208,8 @@ export async function* generateCloner(
|
|
|
208
208
|
* Clones this instance, optionally updating it with the given values.
|
|
209
209
|
* @param values The values to update the clone with.
|
|
210
210
|
* @param options The options to use for cloning.
|
|
211
|
-
* @returns The cloned instance.
|
|
211
|
+
* @returns The cloned instance with its own property arrays. Nested objects
|
|
212
|
+
* and URLs are shared with this instance.
|
|
212
213
|
*/
|
|
213
214
|
${emitOverride(typeUri, types)} clone(
|
|
214
215
|
values:
|
|
@@ -245,7 +246,7 @@ export async function* generateCloner(
|
|
|
245
246
|
const fieldName = await getFieldName(property.uri);
|
|
246
247
|
const trustFieldName = await getFieldName(property.uri, "#_trust");
|
|
247
248
|
const allScalarTypes = areAllScalarTypes(property.range, types);
|
|
248
|
-
yield `clone.${fieldName} = this.${fieldName};`;
|
|
249
|
+
yield `clone.${fieldName} = this.${fieldName}.slice();`;
|
|
249
250
|
if (!allScalarTypes) {
|
|
250
251
|
yield `clone.${trustFieldName} = new Set(this.${trustFieldName});`;
|
|
251
252
|
}
|
|
@@ -309,7 +310,7 @@ export async function* generateCloner(
|
|
|
309
310
|
if (Array.isArray(values.${property.pluralName}) &&
|
|
310
311
|
values.${property.pluralName}.every(v => ${typeGuards})) {
|
|
311
312
|
// @ts-ignore: type is checked above.
|
|
312
|
-
clone.${fieldName} = values.${property.pluralName};
|
|
313
|
+
clone.${fieldName} = values.${property.pluralName}.slice();
|
|
313
314
|
`;
|
|
314
315
|
if (!allScalarTypes) {
|
|
315
316
|
yield `
|