diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-01-26 16:10:31 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-01-26 16:10:31 -0400 |
| commit | 88e30b86922c3fe013d25dcfe0177961f1f11c77 (patch) | |
| tree | a0bb4de3b00e66a710257e6b40c604f782375303 /src/data/composite/wiki-data/withRecontextualizedContributionList.js | |
| parent | a074fd54107c51c4fcbfedbbf6df6eca539d19d3 (diff) | |
data: Thing.clone(source, {as}) and related utilities
Diffstat (limited to 'src/data/composite/wiki-data/withRecontextualizedContributionList.js')
| -rw-r--r-- | src/data/composite/wiki-data/withRecontextualizedContributionList.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/data/composite/wiki-data/withRecontextualizedContributionList.js b/src/data/composite/wiki-data/withRecontextualizedContributionList.js index bcc6e486..66ac056a 100644 --- a/src/data/composite/wiki-data/withRecontextualizedContributionList.js +++ b/src/data/composite/wiki-data/withRecontextualizedContributionList.js @@ -1,14 +1,15 @@ // Clones all the contributions in a list, with thing and thingProperty both // updated to match the current thing. Overwrites the provided dependency. -// Optionally updates artistProperty as well. Doesn't do anything if -// the provided dependency is null. +// Optionally updates artistProperty, and optionally reclasses as another +// kind of contribution. Does nothing if the provided dependency is null. // // See also: // - withRedatedContributionList // import {input, templateCompositeFrom} from '#composite'; -import {isStringNonEmpty} from '#validators'; +import thingConstructors from '#thing'; +import {isStringNonEmpty, isThingClass} from '#validators'; import {withClonedThings} from '#composite/wiki-data'; @@ -21,6 +22,11 @@ export default templateCompositeFrom({ acceptsNull: true, }), + reclass: input({ + validate: isThingClass, + defaultValue: null, + }), + artistProperty: input({ validate: isStringNonEmpty, defaultValue: null, @@ -77,6 +83,8 @@ export default templateCompositeFrom({ withClonedThings({ things: input('list'), + reclass: input('reclass'), + reclassUnder: input.value(thingConstructors.Contribution), assign: '#assignment', }).outputs({ '#clonedThings': '#newContributions', |