Skip to content

Commit

Permalink
Update: Replace lodash.defaultto with koalas (closes #220) (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickyplouis authored and phated committed Nov 28, 2017
1 parent 00e6f95 commit e9ebc09
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions lib/prepare-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var assign = require('object-assign');
var path = require('path');
var fs = require('graceful-fs');
var valueOrFunction = require('value-or-function');
var defaultTo = require('lodash.defaultto');
var koalas = require('koalas');

var fo = require('./file-operations');

Expand All @@ -19,10 +19,10 @@ function prepareWrite(outFolder, file, opt, callback) {

var defaultMode = file.stat ? file.stat.mode : null;
var options = assign({}, opt, {
cwd: defaultTo(string(opt.cwd, file), process.cwd()),
mode: defaultTo(number(opt.mode, file), defaultMode),
cwd: koalas(string(opt.cwd, file), process.cwd()),
mode: koalas(number(opt.mode, file), defaultMode),
dirMode: number(opt.dirMode, file),
overwrite: defaultTo(boolean(opt.overwrite, file), true),
overwrite: koalas(boolean(opt.overwrite, file), true),
});
options.flag = (options.overwrite ? 'w' : 'wx');

Expand Down
14 changes: 7 additions & 7 deletions lib/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var merge = require('merge-stream');
var sourcemaps = require('gulp-sourcemaps');
var isValidGlob = require('is-valid-glob');
var valueOrFunction = require('value-or-function');
var defaultTo = require('lodash.defaultto');
var koalas = require('koalas');

var filterSince = require('../filter-since');
var getContents = require('./get-contents');
Expand All @@ -23,13 +23,13 @@ function src(glob, opt) {
}

var options = assign({}, opt, {
buffer: defaultTo(boolean(opt.buffer), true),
read: defaultTo(boolean(opt.read), true),
buffer: koalas(boolean(opt.buffer), true),
read: koalas(boolean(opt.read), true),
since: date(opt.since),
stripBOM: defaultTo(boolean(opt.stripBOM), true),
sourcemaps: defaultTo(boolean(opt.sourcemaps), false),
passthrough: defaultTo(boolean(opt.passthrough), false),
followSymlinks: defaultTo(boolean(opt.followSymlinks), true),
stripBOM: koalas(boolean(opt.stripBOM), true),
sourcemaps: koalas(boolean(opt.sourcemaps), false),
passthrough: koalas(boolean(opt.passthrough), false),
followSymlinks: koalas(boolean(opt.followSymlinks), true),
});

// Don't pass `read` option on to through2
Expand Down
4 changes: 2 additions & 2 deletions lib/symlink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var path = require('path');
var fs = require('graceful-fs');
var through2 = require('through2');
var valueOrFunction = require('value-or-function');
var defaultTo = require('lodash.defaultto');
var koalas = require('koalas');

var sink = require('../sink');
var prepareWrite = require('../prepare-write');
Expand All @@ -20,7 +20,7 @@ function symlink(outFolder, opt) {
function linkFile(file, enc, callback) {
var srcPath = file.path;
var symType = (file.isDirectory() ? 'dir' : 'file');
var isRelative = defaultTo(boolean(opt.relative, file), false);
var isRelative = koalas(boolean(opt.relative, file), false);

prepareWrite(outFolder, file, opt, onPrepare);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"graceful-fs": "^4.0.0",
"gulp-sourcemaps": "^1.5.2",
"is-valid-glob": "^0.3.0",
"koalas": "^1.0.1",
"lazystream": "^1.0.0",
"lodash.defaultto": "^4.14.0",
"merge-stream": "^1.0.0",
"object-assign": "^4.0.0",
"strip-bom": "^2.0.0",
Expand Down

0 comments on commit e9ebc09

Please sign in to comment.