custom-file
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -26,9 +26,5 @@ (function() { | ||
function AdvanceFile(aPath, aOptions, done) { | ||
var vFS; | ||
if (!(this instanceof AdvanceFile)) { | ||
return new AdvanceFile(aPath, aOptions, done); | ||
} | ||
if (aOptions) { | ||
vFS = aOptions.fs; | ||
} | ||
AdvanceFile.__super__.constructor.apply(this, arguments); | ||
@@ -38,8 +34,7 @@ } | ||
AdvanceFile.prototype._updateFS = function(aFS) { | ||
if (!fs) { | ||
if (!AbstractFile.fs) { | ||
AbstractFile.fs = aFS; | ||
if (!(fs && AbstractFile.fs)) { | ||
if (!aFS) { | ||
aFS = AbstractFile.fs; | ||
} | ||
fs = AbstractFile.fs; | ||
path = fs.path; | ||
fs = aFS; | ||
fs.stat = Promise.promisify(fs.stat, fs); | ||
@@ -50,3 +45,6 @@ fs.readdir = Promise.promisify(fs.readdir, fs); | ||
} | ||
return AdvanceFile.__super__._updateFS.call(this, aFS); | ||
AdvanceFile.__super__._updateFS.call(this, aFS); | ||
if (!path) { | ||
return path = fs.path; | ||
} | ||
}; | ||
@@ -53,0 +51,0 @@ |
@@ -32,7 +32,7 @@ (function() { | ||
File.prototype._updateFS = function(aFS) { | ||
if (!fs) { | ||
if (!AbstractFile.fs) { | ||
AbstractFile.fs = aFS; | ||
} | ||
if (!(fs && AbstractFile.fs)) { | ||
AbstractFile.fs = aFS; | ||
fs = AbstractFile.fs; | ||
/* !pragma coverage-skip-next */ | ||
if (!fs) { | ||
@@ -39,0 +39,0 @@ throw new TypeError('no file system specified'); |
@@ -26,9 +26,5 @@ (function() { | ||
function Folder(aPath, aOptions, done) { | ||
var vFS; | ||
if (!(this instanceof Folder)) { | ||
return new Folder(aPath, aOptions, done); | ||
} | ||
if (aOptions) { | ||
vFS = aOptions.fs; | ||
} | ||
Folder.__super__.constructor.apply(this, arguments); | ||
@@ -38,7 +34,7 @@ } | ||
Folder.prototype._updateFS = function(aFS) { | ||
if (!fs) { | ||
if (!AbstractFile.fs) { | ||
AbstractFile.fs = aFS; | ||
if (!(fs && AbstractFile.fs)) { | ||
if (!aFS) { | ||
aFS = AbstractFile.fs; | ||
} | ||
fs = AbstractFile.fs; | ||
fs = aFS; | ||
path = fs.path; | ||
@@ -45,0 +41,0 @@ fs.stat = Promise.promisify(fs.stat, fs); |
@@ -21,5 +21,2 @@ (function() { | ||
var result, vOpts; | ||
if (!AbstractFile.fs) { | ||
throw new TypeError('no file system specified'); | ||
} | ||
if (isObject(aPath)) { | ||
@@ -26,0 +23,0 @@ if (aOptions) { |
{ | ||
"name": "custom-file", | ||
"description": "It abstracts the File and Folder classes, can be used on any virtual file system, and stream supports.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"homepage": "https://github.com/snowyu/custom-file.js", | ||
@@ -41,2 +41,3 @@ "repository": { | ||
"chai": "~1.10.0", | ||
"coffee-coverage": "^0.6.2", | ||
"grunt": "~0.4.5", | ||
@@ -50,2 +51,3 @@ "grunt-contrib-clean": "~0.6.0", | ||
"grunt-release": "~0.9.0", | ||
"istanbul": "^0.3.17", | ||
"mocha": "~2.1.0", | ||
@@ -59,3 +61,4 @@ "pre-commit": "~1.0.2", | ||
"scripts": { | ||
"test": "grunt test" | ||
"test": "grunt test", | ||
"test-cov": "mocha --reporter dot && istanbul report text-summary lcovonly" | ||
}, | ||
@@ -62,0 +65,0 @@ "contributors": [ |
## custom-file [![npm](https://img.shields.io/npm/v/custom-file.svg)](https://npmjs.org/package/custom-file) | ||
[![Build Status](https://img.shields.io/travis/snowyu/custom-file.js/master.svg)](http://travis-ci.org/snowyu/custom-file.js) | ||
[![Code Climate](https://codeclimate.com/github/snowyu/custom-file.js/badges/gpa.svg)](https://codeclimate.com/github/snowyu/custom-file.js) | ||
[![Test Coverage](https://codeclimate.com/github/snowyu/custom-file.js/badges/coverage.svg)](https://codeclimate.com/github/snowyu/custom-file.js/coverage) | ||
[![downloads](https://img.shields.io/npm/dm/custom-file.svg)](https://npmjs.org/package/custom-file) | ||
@@ -5,0 +7,0 @@ [![license](https://img.shields.io/npm/l/custom-file.svg)](https://npmjs.org/package/custom-file) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
50477
33
150
17
403