dist/emitter.js
function toEmitter( selection, target ){
    
    // Apply the entire Emitter API
    if( selection === API ){
        asEmitter.call( target );
    
    // Apply only the selected API methods
    } else {
        let index, key, mapping, names, value;
        
        if( typeof selection === 'string' ){
            names = selection.split( ' ' );
            mapping = API;
        } else {
            names = Object.keys( selection );
            mapping = selection;
        }
        
        index = names.length;
        
        while( index-- ){
            key = names[ index ];
            value = mapping[ key ];
            
            target[ key ] = typeof value === 'function' ?
                value :
                API[ value ];
        }
    }
}
function toEmitter( selection, target ){
    
    // Apply the entire Emitter API
    if( selection === API ){
        asEmitter.call( target );
    
    // Apply only the selected API methods
    } else {
        let index, key, mapping, names, value;
        
        if( typeof selection === 'string' ){
            names = selection.split( ' ' );
            mapping = API;
        } else {
            names = Object.keys( selection );
            mapping = selection;
        }
        
        index = names.length;
        
        while( index-- ){
            key = names[ index ];
            value = mapping[ key ];
            
            target[ key ] = typeof value === 'function' ?
                value :
                API[ value ];
        }
    }
}
function toEmitter ( selection , target ) { // Apply the entire Emitter API if ( selection === API ) { asEmitter . call ( target ) ; // Apply only the selected API methods } else { let index , key , mapping , names , value ; if ( typeof selection === 'string' ) { names = selection . split ( ' ' ) ; mapping = API ; } else { names = Object . keys ( selection ) ; mapping = selection ; } index = names . length ; while ( index -- ) { key = names [ index ] ; value = mapping [ key ] ; target [ key ] = typeof value === 'function' ? value : API [ value ] ; } } }
Applies a `selection` of the Emitter.js API to the `target`.
@function Emitter~toEmitter
@param {APIReference} [selection] A selection of the Emitter.js API.
@param {external:Object} target The object on which the API will be applied.
Applies a selection of the Emitter . js API to the target .