Comparing version 1.0.1 to 1.0.2
var fs = require('fs'); | ||
var isString = require('lodash.isstring'); | ||
@@ -10,11 +11,3 @@ var Transformer = require('./transform'); | ||
if (!isReadStream(input)) { | ||
throw new Error('No input stream specified!'); | ||
} | ||
if (!isWriteStream(output)) { | ||
throw new Error('No output stream specified!'); | ||
} | ||
if (typeof input === 'string') { | ||
if (isString(input)) { | ||
input = fs.createReadStream(input); | ||
@@ -26,3 +19,3 @@ } | ||
if (output !== 'string') { | ||
if (typeof output === 'string') { | ||
if (isString(output)) { | ||
stream = fs.createWriteStream(output); | ||
@@ -36,2 +29,10 @@ } else { | ||
if (!isReadStream(input)) { | ||
throw new Error('No input stream specified!'); | ||
} | ||
if (!isWriteStream(stream)) { | ||
throw new Error('No output stream specified!'); | ||
} | ||
var transformer = new Transformer(); | ||
@@ -62,12 +63,14 @@ | ||
function isReadStream(rs){ | ||
return isStream(rs, process.stdin, '_read'); | ||
function isReadStream(obj) { | ||
// some streams are readable but do not have `read()`, however | ||
// we can reliably detect readability by testing for `resume()` | ||
return isStream(obj) && typeof obj.resume === 'function'; | ||
} | ||
function isWriteStream(ws){ | ||
return isStream(ws, process.stdout, '_write'); | ||
function isWriteStream(obj) { | ||
return isStream(obj) && typeof obj.write === 'function'; | ||
} | ||
function isStream(st, sys, prop){ | ||
return st && (st === sys|| typeof(st[prop]) === 'function' || typeof(st) === 'string'); | ||
} | ||
function isStream(obj) { | ||
return obj && typeof obj.pipe === 'function'; | ||
} |
@@ -0,0 +0,0 @@ var Stream = require('readable-stream'); |
{ | ||
"name": "neek", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A simple implementation of *nix uniq in NodeJS to take advantage of streaming", | ||
@@ -34,21 +34,22 @@ "author": { | ||
"dependencies": { | ||
"farmhash": "^1.1.1", | ||
"hashes": "0.1.3", | ||
"farmhash": "^1.2.1", | ||
"hashes": "0.1.4", | ||
"lodash.isstring": "4.0.1", | ||
"minimist": "1.2.0", | ||
"readable-stream": "2.1.4" | ||
"readable-stream": "2.1.5" | ||
}, | ||
"devDependencies": { | ||
"grunt": "0.4.5", | ||
"grunt": "1.0.1", | ||
"grunt-cli": "1.2.0", | ||
"grunt-codeclimate-reporter": "1.1.2", | ||
"grunt-codeclimate-reporter": "1.2.1", | ||
"grunt-contrib-clean": "1.0.0", | ||
"grunt-contrib-jshint": "1.0.0", | ||
"grunt-mkdir": "1.0.0", | ||
"grunt-mocha-istanbul": "4.0.2", | ||
"grunt-mocha-test": "0.12.7", | ||
"istanbul": "0.4.3", | ||
"jshint": "2.9.2", | ||
"mocha": "2.4.5", | ||
"should": "8.3.2" | ||
"grunt-mocha-istanbul": "5.0.2", | ||
"grunt-mocha-test": "0.13.2", | ||
"istanbul": "0.4.5", | ||
"jshint": "2.9.3", | ||
"mocha": "3.1.0", | ||
"should": "11.1.0" | ||
} | ||
} |
@@ -0,0 +0,0 @@ Neek [![Build Status](https://travis-ci.org/zackehh/neek.svg?branch=master)](https://travis-ci.org/zackehh/neek) [![Code Climate](https://codeclimate.com/github/zackehh/neek/badges/gpa.svg)](https://codeclimate.com/github/zackehh/neek) [![Test Coverage](https://codeclimate.com/github/zackehh/neek/badges/coverage.svg)](https://codeclimate.com/github/zackehh/neek) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
37927
20
1
5
146
+ Addedlodash.isstring@4.0.1
+ Addedhashes@0.1.4(transitive)
+ Addedlodash.isstring@4.0.1(transitive)
+ Addedreadable-stream@2.1.5(transitive)
- Removedhashes@0.1.3(transitive)
- Removedreadable-stream@2.1.4(transitive)
Updatedfarmhash@^1.2.1
Updatedhashes@0.1.4
Updatedreadable-stream@2.1.5