Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make require('difflet').compare(prev, next) work too

  • Loading branch information...
commit 2b364f1e3aa9b4b19079595a8419791c769db230 1 parent d8aaea6
James Halliday authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 index.js
8 index.js
View
@@ -3,7 +3,7 @@ var Stream = require('stream').Stream;
var charm = require('charm');
var deepEqual = require('deep-equal');
-module.exports = function (opts_) {
+var exports = module.exports = function (opts_) {
var fn = difflet.bind(null, opts_);
fn.compare = function (prev, next) {
var opts = Object.keys(opts_ || {}).reduce(function (acc, key) {
@@ -23,6 +23,10 @@ module.exports = function (opts_) {
return fn;
};
+exports.compare = function (prev, next) {
+ return exports({}).compare(prev, next);
+};
+
function difflet (opts, prev, next) {
var stream = opts.stream || new Stream;
if (!opts.stream) {
@@ -48,7 +52,7 @@ function difflet (opts, prev, next) {
}
var write = function (buf) {
if (opts.write) opts.write(buf, stream)
- else s.write(buf)
+ else stream.write(buf)
};
var commaFirst = opts.comma === 'first';
Please sign in to comment.
Something went wrong with that request. Please try again.