From d0b80ee3910bc079ded03ce5762719469e47f083 Mon Sep 17 00:00:00 2001 From: "Johannes J. Schmidt" Date: Mon, 2 Jun 2014 15:03:19 +0200 Subject: [PATCH] we do not need no arity --- README.md | 9 --------- index.js | 11 ----------- package.json | 2 +- test/arity_test.js | 36 ------------------------------------ 4 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 test/arity_test.js diff --git a/README.md b/README.md index 235468d..b713a58 100644 --- a/README.md +++ b/README.md @@ -65,15 +65,6 @@ docuri.parts({ type: 'mytype', subtype: 'mysubtype' }); // ['mytype', undefined, 'mysubtype'] ``` -### `arity(objectOrString)` -Length of parts: -```js -docuri.arity('mytype/myid/'); -// 2 -docuri.arity({ type: 'mytype', subtype: 'mysubtype' }); -// 3 -``` - ### `docuri.definition([array])` Access or use custom definition: ```js diff --git a/index.js b/index.js index b808a1d..7ca8d9f 100644 --- a/index.js +++ b/index.js @@ -72,14 +72,3 @@ docuri.merge = function(obj, objToMerge) { return docuri.stringify(obj); }; -docuri.arity = function(obj) { - if (typeof obj === 'string') { - obj = docuri.parse(obj); - } - - return docuri.parts(obj).length; -}; - - -module.exports = docuri; - diff --git a/package.json b/package.json index ab7a466..4c835c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docuri", - "version": "3.0.0", + "version": "3.0.1", "description": "Rich document ids for CouchDB", "main": "index.js", "scripts": { diff --git a/test/arity_test.js b/test/arity_test.js deleted file mode 100644 index d8c4a06..0000000 --- a/test/arity_test.js +++ /dev/null @@ -1,36 +0,0 @@ -var test = require('tap').test; -var arity = require('..').arity; - -test('arity of type string', function(t) { - t.equal(arity('type'), 1, 'should return 1'); - t.end(); -}); -test('arity of type/id string', function(t) { - t.equal(arity('type/id'), 2, 'should return 2'); - t.end(); -}); -test('arity of type/id/subtype string', function(t) { - t.equal(arity('type/id/subtype'), 3, 'should return 3'); - t.end(); -}); -test('arity of type//subtype string', function(t) { - t.equal(arity('type//subtype'), 3, 'should return 3'); - t.end(); -}); - -test('arity of type object', function(t) { - t.equal(arity({ type: 'type' }), 1, 'should return 1'); - t.end(); -}); -test('arity of type/id object', function(t) { - t.equal(arity({ type: 'type', id: 'id'}), 2, 'should return 2'); - t.end(); -}); -test('arity of type/id/subtype object', function(t) { - t.equal(arity({ type: 'type', id: 'id', subtype: 'subtype' }), 3, 'should return 3'); - t.end(); -}); -test('arity of type//subtype object', function(t) { - t.equal(arity({ type: 'type', subtype: 'subtype' }), 3, 'should return 3'); - t.end(); -});