Skip to content

Commit 660b999

Browse files
committed
clean up, fix link
1 parent 89bb7c6 commit 660b999

File tree

6 files changed

+41
-17
lines changed

6 files changed

+41
-17
lines changed

.verb.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# {%= name %} {%= badge("fury") %}
1+
# {%= name %} {%= badge("fury") %} {%= badge("travis") %}
22

33
> {%= description %}
44
5-
Why another `difference` lib? I wanted the [fastest, correct implementation](./benchmarks) I could find.
5+
Why another array `difference` lib? I wanted the [fastest, correct implementation](./benchmark) I could find.
66

77
## Install
88
{%= include("install-npm", {save: true}) %}
@@ -18,13 +18,11 @@ npm test
1818

1919
```js
2020
var diff = require('{%= name %}');
21+
```
2122

22-
var a = ['a', 'b', 'c', 'd'];
23-
var b = ['b', 'c'];
23+
## API
24+
{%= comments("index.js") %}
2425

25-
console.log(difference(a, b))
26-
//=> ['a', 'd']
27-
```
2826

2927
## Author
3028
{%= include("author") %}

LICENSE-MIT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
The MIT License (MIT)
2+
13
Copyright (c) 2014 Jon Schlinkert, contributors.
24

35
Permission is hereby granted, free of charge, to any person

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# arr-diff [![NPM version](https://badge.fury.io/js/arr-diff.svg)](http://badge.fury.io/js/arr-diff)
1+
# arr-diff [![NPM version](https://badge.fury.io/js/arr-diff.svg)](http://badge.fury.io/js/arr-diff) [![Build Status](https://travis-ci.org/jonschlinkert/arr-diff.svg)](https://travis-ci.org/jonschlinkert/arr-diff)
22

33
> Return an array with only the unique values present in all given arrays using strict equality for comparisons.
44
5-
Why another `difference` lib? I wanted the [fastest, correct implementation](./benchmarks) I could find.
5+
Why another array `difference` lib? I wanted the [fastest, correct implementation](./benchmark) I could find.
66

77
## Install
88
## Install with [npm](npmjs.org)
@@ -26,14 +26,27 @@ npm test
2626

2727
```js
2828
var diff = require('arr-diff');
29+
```
30+
31+
## API
32+
### [diff](index.js#L33)
33+
34+
Return the difference between two arrays.
35+
36+
* `a` **{Array}**
37+
* `b` **{Array}**
38+
* `returns`: {Array}
2939

40+
```js
3041
var a = ['a', 'b', 'c', 'd'];
3142
var b = ['b', 'c'];
3243

3344
console.log(difference(a, b))
3445
//=> ['a', 'd']
3546
```
3647

48+
49+
3750
## Author
3851

3952
**Jon Schlinkert**
@@ -69,4 +82,4 @@ Released under the MIT license
6982

7083
***
7184

72-
_This file was generated by [verb](https://github.com/assemble/verb) on November 30, 2014._
85+
_This file was generated by [verb](https://github.com/assemble/verb) on December 01, 2014._

index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88
'use strict';
99

10+
/**
11+
* Expose `diff`
12+
*/
13+
14+
module.exports = diff;
15+
1016
/**
1117
* Return the difference between two arrays.
1218
*
@@ -21,9 +27,10 @@
2127
* @param {Array} `a`
2228
* @param {Array} `b`
2329
* @return {Array}
30+
* @api public
2431
*/
2532

26-
module.exports = function diff(a, b) {
33+
function diff(a, b) {
2734
var alen = a.length - 1;
2835
var blen = b.length;
2936

@@ -43,4 +50,4 @@ module.exports = function diff(a, b) {
4350
}
4451
}
4552
return arr;
46-
};
53+
}

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "arr-diff",
33
"description": "Return an array with only the unique values present in all given arrays using strict equality for comparisons.",
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"homepage": "https://github.com/jonschlinkert/arr-diff",
66
"author": {
77
"name": "Jon Schlinkert",
@@ -30,9 +30,7 @@
3030
"devDependencies": {
3131
"benchmarked": "^0.1.3",
3232
"mocha": "*",
33-
"should": "^4.0.4",
34-
"verb": ">= 0.2.6",
35-
"verb-tag-jscomments": ">= 0.2.0"
33+
"should": "^4.0.4"
3634
},
3735
"keywords": [
3836
"arr",

test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ describe('diff', function () {
1414
it('should diff array:', function () {
1515
diff(['a', 'b', 'c'], ['b', 'c', 'e']).should.eql(['a']);
1616
diff(['foo', 'b', 'c', 'e', 'bar'], ['b', 'foo', 'e']).should.eql(['bar', 'c']);
17+
diff(['foo', 'foo'], ['a', 'b', 'c']).should.eql(['foo', 'foo']);
18+
diff(['foo'], ['a', 'b', 'c']).should.eql([]);
1719
});
18-
});
20+
21+
it('should return an empty array if no unique elements are in the first array:', function () {
22+
diff(['foo'], ['a', 'b', 'c', 'foo']).should.eql([]);
23+
});
24+
});

0 commit comments

Comments
 (0)