aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/methods.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/methods.js')
-rw-r--r--src/utils/methods.js50
1 files changed, 15 insertions, 35 deletions
diff --git a/src/utils/methods.js b/src/utils/methods.js
index 4973d13..527e7b7 100644
--- a/src/utils/methods.js
+++ b/src/utils/methods.js
@@ -2,61 +2,41 @@ const methods = {}
const constructors = {}
const names = []
-export function registerMethods ( name, m ) {
-
- if ( Array.isArray( name ) ) {
-
- for ( let _name of name ) {
-
- registerMethods( _name, m )
-
+export function registerMethods (name, m) {
+ if (Array.isArray(name)) {
+ for (let _name of name) {
+ registerMethods(_name, m)
}
return
-
}
- if ( typeof name === 'object' ) {
-
- for ( let [ _name, _m ] of Object.entries( name ) ) {
-
- registerMethods( _name, _m )
-
+ if (typeof name === 'object') {
+ for (let [ _name, _m ] of Object.entries(name)) {
+ registerMethods(_name, _m)
}
return
-
}
- addMethodNames( Object.keys( m ) )
- methods[name] = Object.assign( methods[name] || {}, m )
-
+ addMethodNames(Object.keys(m))
+ methods[name] = Object.assign(methods[name] || {}, m)
}
-export function getMethodsFor ( name ) {
-
+export function getMethodsFor (name) {
return methods[name] || {}
-
}
export function getMethodNames () {
-
- return [ ...new Set( names ) ]
-
+ return [ ...new Set(names) ]
}
-export function addMethodNames ( _names ) {
-
- names.push( ..._names )
-
+export function addMethodNames (_names) {
+ names.push(..._names)
}
-export function registerConstructor ( name, setup ) {
-
+export function registerConstructor (name, setup) {
constructors[name] = setup
-
}
-export function getConstructor ( name ) {
-
+export function getConstructor (name) {
return constructors[name] ? { setup: constructors[name], name } : {}
-
}