From 7450f434fe918f542498fbbc3fa142d3c12db2ba Mon Sep 17 00:00:00 2001 From: jonschlinkert Date: Mon, 3 Aug 2015 07:31:01 -0400 Subject: [PATCH] removed unused code --- lib/loaders/last.js | 73 --------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 lib/loaders/last.js diff --git a/lib/loaders/last.js b/lib/loaders/last.js deleted file mode 100644 index 7533dba..0000000 --- a/lib/loaders/last.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; - -var lazy = require('lazy-cache')(require); -var through = lazy('through2'); -var promise = lazy('bluebird'); -var utils = require('../utils'); - -/** - * Last loaders. - * - * The loaders are pushed onto every loader stack to ensure that - * views are loaded correctly onto their respective collection - * objects. - */ - -module.exports = function (collection, fn) { - fn = fn || utils.identity; - var loaders = {}; - - if (typeof collection.set !== 'function') { - throw new Error('last loaders: collection is not defined.'); - } - - /** - * Sync loader - */ - - loaders.sync = function lastSync(views) { - return extendCollection(views); - }; - - /** - * Async loader - */ - - loaders.async = function lastAsync(views, next) { - try { - next(null, extendCollection(views)); - } catch (err) { - next(err); - } - }; - - /** - * Promise loader - */ - - loaders.promise = promise().method(loaders.sync); - - /** - * Streams loader - */ - - loaders.stream = through().obj(function lastStream(file, enc, next) { - try { - collection[file.path] = fn(file.path, file); - this.push(file); - } catch (err) { - this.emit('error', err); - } - return next(); - }); - - /** - * Add `views` to the current collection. - */ - - function extendCollection(views) { - collection.visit('set', views); - } - - return loaders; -};