diff --git a/app/data/ct.release/types.js b/app/data/ct.release/types.js index 87c02b9a9..99e35ed68 100644 --- a/app/data/ct.release/types.js +++ b/app/data/ct.release/types.js @@ -318,12 +318,24 @@ const Copy = (function Copy() { func.apply(copy, this); } }, - /* + /** * Applies a function to a given object (e.g. to a copy) + * @param {Copy} obj The copy to perform function upon. + * @param {Function} function The function to be applied. */ - 'with'(obj, func) { + withCopy(obj, func) { func.apply(obj, this); }, + /** + * Applies a function to a given object (e.g. to a copy) + * @param {string} type The name of the type to perform function upon. + * @param {Function} function The function to be applied. + */ + withType(type, func) { + for (const copy of ct.types.list[type]) { + func.apply(copy, this); + } + }, /** * Checks whether there are any copies of this type's name. * Will throw an error if you pass an invalid type name.