we do not need no arity

pull/9/head
Johannes J. Schmidt 10 years ago
parent ac4af0f980
commit d0b80ee391

@ -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

@ -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;

@ -1,6 +1,6 @@
{
"name": "docuri",
"version": "3.0.0",
"version": "3.0.1",
"description": "Rich document ids for CouchDB",
"main": "index.js",
"scripts": {

@ -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();
});
Loading…
Cancel
Save