function split(obj, firstObjFields, settings) {
    /*jshint laxbreak:true*/
    var bObject = ! isMap(obj),
        first = bObject ? {} : new Map(),
        second = bObject ? {} : new Map(),
        result = [first, second],
        bByName, filter, key, keyList, nI, nL;

    function getTarget() {
        return (bByName ? key in firstObjFields : checkField(obj, key, filter, settings))
            ? first
            : second;
    }

    if (! settings) {
        settings = {};
    }
    if (firstObjFields) {
        bByName = true;
        if (typeof firstObjFields.length === "number") {
            firstObjFields = fromArray(firstObjFields);
        }
    }
    else {
        bByName = false;
        filter = settings.filter;
    }
    if (bObject) {
        for (key in obj) {
            getTarget()[key] = obj[key];
        }
    }
    else {
        keyList = getKeys(obj);
        for (nI = 0, nL = keyList.length; nI < nL; nI++) {
            key = keyList[nI];
            getTarget().set(key, obj.get(key));
        }
    }
    return result;
}
/**
 * Divide given object or map into 2 parts: the first part includes specified fields, the second part includes all other fields.
 * 
 * @param {Object} obj
 *      Object or map to be divided.
 * @param {Array | Object | null} firstObjFields
 *      List of names of fields that should be included in the first part,
 *      or an object defining those fields.
 *      If value is not specified (`null` or `undefined`), `filter` setting should be used to divide fields into parts.
 * @param {Object} [settings]
 *     Operation settings. Keys are settings names, values are corresponding settings values.
 *     The following settings are supported:
 *     
 *   * `filter` - a filter that should be used to divide fields into parts (see {@link module:adam.checkField checkField});
 *      fields conforming to the filter will be included in the first part,
 *      fields that do not conform to the filter will be included in the second part
 *   * `filterConnect`: `String` - a boolean connector that should be used when array of filters is specified
 *      in `filter` setting (see {@link module:adam.checkField checkField})
 * @return {Array}
 *      Created parts: item with index 0 is the first part, item with index 1 is the second part.
 * @alias module:adam.split
 * @see {@link module:adam.checkField checkField}
 */
Divide given object or map into 2 parts: the first part includes specified fields, the second part includes all other fields.

@param {Object} obj
Object or map to be divided.
@param {Array | Object | null} firstObjFields
List of names of fields that should be included in the first part,
or an object defining those fields.


Divide given object or map into 2 parts : the first part includes specified fields the second part includes all other fields . @param { Object } obj Object or map to be divided . @param { Array | Object | null } firstObjFields List of names of fields that should be included in the first part or an object defining those fields .
function split(obj, firstObjFields, settings) {
    var bObject = ! isMap(obj),
        first = bObject ? {} : new Map(),
        second = bObject ? {} : new Map(),
        result = [first, second],
        bByName, filter, key, keyList, nI, nL;
    function getTarget() {
        return (bByName ? key in firstObjFields : checkField(obj, key, filter, settings))
            ? first
            : second;
    }
    if (! settings) {
        settings = {};
    }
    if (firstObjFields) {
        bByName = true;
        if (typeof firstObjFields.length === "number") {
            firstObjFields = fromArray(firstObjFields);
        }
    }
    else {
        bByName = false;
        filter = settings.filter;
    }
    if (bObject) {
        for (key in obj) {
            getTarget()[key] = obj[key];
        }
    }
    else {
        keyList = getKeys(obj);
        for (nI = 0, nL = keyList.length; nI < nL; nI++) {
            key = keyList[nI];
            getTarget().set(key, obj.get(key));
        }
    }
    return result;
}
function split ( obj , firstObjFields , settings ) { var bObject = ! isMap ( obj ) , first = bObject ? { } : new Map ( ) , second = bObject ? { } : new Map ( ) , result = [ first , second ] , bByName , filter , key , keyList , nI , nL ; function getTarget ( ) { return ( bByName ? key in firstObjFields : checkField ( obj , key , filter , settings ) ) ? first : second ; } if ( ! settings ) { settings = { } ; } if ( firstObjFields ) { bByName = true ; if ( typeof firstObjFields . length === "number" ) { firstObjFields = fromArray ( firstObjFields ) ; } } else { bByName = false ; filter = settings . filter ; } if ( bObject ) { for ( key in obj ) { getTarget ( ) [ key ] = obj [ key ] ; } } else { keyList = getKeys ( obj ) ; for ( nI = 0 , nL = keyList . length ; nI < nL ; nI ++ ) { key = keyList [ nI ] ; getTarget ( ) . set ( key , obj . get ( key ) ) ; } } return result ; }
Divide given object or map into 2 parts: the first part includes specified fields, the second part includes all other fields.
Divide given object or map into 2 parts : the first part includes specified fields the second part includes all other fields .
/*jshint laxbreak:true*/