extract-github
Advanced tools
@@ -30,3 +30,7 @@ 'use strict'; | ||
if ('string' === type && ~data.indexOf(contains)) return data; | ||
if ('string' === type) { | ||
if (!contains) return data; | ||
else if (~data.indexOf(contains)) return data; | ||
} | ||
if ('object' === type) { | ||
@@ -33,0 +37,0 @@ if ('url' in data && (match = url(data.url, contains))) return match; |
{ | ||
"name": "extract-github", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Extract the Github project / repository URL from a given object", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,2 +64,9 @@ describe('extract-github', function () { | ||
}); | ||
it('has optional string matching', function () { | ||
expect(extract.url({ url: 'google.com', web: 'github.com'})).to.equal('google.com'); | ||
expect(extract.url('google.com')).to.equal('google.com'); | ||
expect(extract.url({ foo: 'foo' })).to.equal(undefined); | ||
expect(extract.url({ url: {} })).to.equal(undefined); | ||
}); | ||
}); | ||
@@ -66,0 +73,0 @@ |
8833
4.62%181
5.23%