Skip to content

Commit

Permalink
🔥 Replace ct.types.with with ct.types.withCopy and ct.types.withType.
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Dec 22, 2021
1 parent dbad7e3 commit 58e6fad
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/data/ct.release/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 58e6fad

Please sign in to comment.