lib/normalizers/v1.js
function (collectionV1) {
        if (_.isEmpty(collectionV1 && collectionV1.folders)) { return; }

        var auth,
            events,
            variables,
            self = this,
            order,
            foldersOrder,
            retainEmpty = self.options.retainEmptyValues,
            varOpts = { noDefaults: self.options.noDefaults };

        _.forEach(collectionV1.folders, function (folder) {
            if (!folder) { return; }

            // if noDefaults is true, do not replace the id
            // else
            // if id is falsy, replace the id
            // if retainIds is false, replace the id
            !((self.options.retainIds && folder.id) || self.options.noDefaults) && (folder.id = util.uid());
            util.cleanEmptyValue(folder, 'description', retainEmpty);

            auth = self.auth(folder);

            !_.isEmpty((order = self.order(folder))) && (folder.order = order);
            !_.isEmpty((foldersOrder = self.folders_order(folder))) && (folder.folders_order = foldersOrder);

            (auth || (auth === null)) && (folder.auth = auth);
            (events = self.events(folder)) && (folder.events = events);
            (variables = self.variables(folder, varOpts)) && (folder.variables = variables);
        });

        return _.compact(collectionV1.folders);
    }
function (collectionV1) {
        if (_.isEmpty(collectionV1 && collectionV1.folders)) { return; }

        var auth,
            events,
            variables,
            self = this,
            order,
            foldersOrder,
            retainEmpty = self.options.retainEmptyValues,
            varOpts = { noDefaults: self.options.noDefaults };

        _.forEach(collectionV1.folders, function (folder) {
            if (!folder) { return; }

            // if noDefaults is true, do not replace the id
            // else
            // if id is falsy, replace the id
            // if retainIds is false, replace the id
            !((self.options.retainIds && folder.id) || self.options.noDefaults) && (folder.id = util.uid());
            util.cleanEmptyValue(folder, 'description', retainEmpty);

            auth = self.auth(folder);

            !_.isEmpty((order = self.order(folder))) && (folder.order = order);
            !_.isEmpty((foldersOrder = self.folders_order(folder))) && (folder.folders_order = foldersOrder);

            (auth || (auth === null)) && (folder.auth = auth);
            (events = self.events(folder)) && (folder.events = events);
            (variables = self.variables(folder, varOpts)) && (folder.variables = variables);
        });

        return _.compact(collectionV1.folders);
    }
function ( collectionV1 ) { if ( _ . isEmpty ( collectionV1 && collectionV1 . folders ) ) { return ; } var auth , events , variables , self = this , order , foldersOrder , retainEmpty = self . options . retainEmptyValues , varOpts = { noDefaults : self . options . noDefaults } ; _ . forEach ( collectionV1 . folders , function ( folder ) { if ( ! folder ) { return ; } // if noDefaults is true, do not replace the id // else // if id is falsy, replace the id // if retainIds is false, replace the id ! ( ( self . options . retainIds && folder . id ) || self . options . noDefaults ) && ( folder . id = util . uid ( ) ) ; util . cleanEmptyValue ( folder , 'description' , retainEmpty ) ; auth = self . auth ( folder ) ; ! _ . isEmpty ( ( order = self . order ( folder ) ) ) && ( folder . order = order ) ; ! _ . isEmpty ( ( foldersOrder = self . folders_order ( folder ) ) ) && ( folder . folders_order = foldersOrder ) ; ( auth || ( auth === null ) ) && ( folder . auth = auth ) ; ( events = self . events ( folder ) ) && ( folder . events = events ) ; ( variables = self . variables ( folder , varOpts ) ) && ( folder . variables = variables ) ; } ) ; return _ . compact ( collectionV1 . folders ) ; }
Normalizes a potentially raw v1 folders list.

@param {Object} collectionV1 - The potentially raw v1 collection object.
@returns {Object[]} - The normalized v1 collection folders list.
Normalizes a potentially raw v1 folders list .