src/collection.js
/**
 * Register a directive to global
 * @param name
 * @param cfg
 */
Register a directive to global
@param name
@param cfg
Register a directive to global @param name @param cfg
function registerDirective(name, cfg = {}) {
    if (typeof name !== 'string') {
        throw new TypeError('Doz directive name must be a string');
    }
    if (typeof cfg !== 'object' || !cfg) {
        throw new TypeError('Doz directive config must be an object');
    }
    if (name[0] === ':') {
        cfg._onlyDozComponent = true;
        name = name.substr(1);
    }
    name = name.toLowerCase();
    let namePart = [];
    if (name.indexOf('-') !== -1) {
        namePart = name.split('-');
        name = namePart[0];
        namePart.shift();
    }
    cfg.name = name;
    cfg._keyArguments = namePart.map(item => item.substr(1)); 
    if (Object.prototype.hasOwnProperty.call(data.directives, name))
        console.warn('Doz', `directive ${name} overwritten`);
    data.directives[name] = cfg;
    if (!data.directivesKeys.includes(name))
        data.directivesKeys.push(name);
}
function registerDirective ( name , cfg = { } ) { if ( typeof name !== 'string' ) { throw new TypeError ( 'Doz directive name must be a string' ) ; } if ( typeof cfg !== 'object' || ! cfg ) { throw new TypeError ( 'Doz directive config must be an object' ) ; } if ( name [ 0 ] === ':' ) { cfg . _onlyDozComponent = true ; name = name . substr ( 1 ) ; } name = name . toLowerCase ( ) ; let namePart = [ ] ; if ( name . indexOf ( '-' ) !== - 1 ) { namePart = name . split ( '-' ) ; name = namePart [ 0 ] ; namePart . shift ( ) ; } cfg . name = name ; cfg . _keyArguments = namePart . map ( item => item . substr ( 1 ) ) ; if ( Object . prototype . hasOwnProperty . call ( data . directives , name ) ) console . warn ( 'Doz' , ` ${ name } ` ) ; data . directives [ name ] = cfg ; if ( ! data . directivesKeys . includes ( name ) ) data . directivesKeys . push ( name ) ; }
Register a directive to global
 @param name
 @param cfg
Register a directive to global @param name @param cfg
// remove $