mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-18 11:37:33 +08:00
Attributes initialization refactoring (#19)
This commit is contained in:
@@ -189,6 +189,12 @@ export default class Utility {
|
||||
* @param {Attribute} b
|
||||
*/
|
||||
static equals(a, b) {
|
||||
while (a instanceof MirroredEntity) {
|
||||
a = a.get()
|
||||
}
|
||||
while (b instanceof MirroredEntity) {
|
||||
b = b.get()
|
||||
}
|
||||
// Here we cannot check both instanceof IEntity because this would introduce a circular include dependency
|
||||
if (/** @type {IEntity?} */(a)?.equals && /** @type {IEntity?} */(b)?.equals) {
|
||||
return /** @type {IEntity} */(a).equals(/** @type {IEntity} */(b))
|
||||
@@ -423,6 +429,11 @@ export default class Utility {
|
||||
return Array.from({ length: Math.ceil((end - begin) / step) }, (_, i) => begin + (i * step))
|
||||
}
|
||||
|
||||
/** @param {String[]} words */
|
||||
static getFirstWordOrder(words) {
|
||||
return new RegExp(/\s*/.source + words.join(/[^\n]+\n\s*/.source) + /\s*/.source)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} element
|
||||
* @param {String} value
|
||||
|
||||
Reference in New Issue
Block a user