mirror of https://github.com/jo/docuri.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
775 B
Markdown
49 lines
775 B
Markdown
11 years ago
|
docuri
|
||
|
======
|
||
|
Rich document ids for CouchDB.
|
||
|
|
||
|
`type/id/subtype/version/index`
|
||
|
|
||
|
eg `movie/blade-runner/gallery-image/medium/12`
|
||
|
|
||
|
## Usage
|
||
|
Parse id string:
|
||
|
```js
|
||
|
require('docuri').parse('mytype/myid/mysubtype/myversion/myindex');
|
||
|
// {
|
||
|
// type: 'mytype',
|
||
|
// id: 'myid',
|
||
|
// subtype: 'mysubtype',
|
||
|
// version: 'myversion',
|
||
|
// index: 'myindex'
|
||
|
// }
|
||
|
```
|
||
|
|
||
|
Build id string from object:
|
||
|
```js
|
||
|
require('docuri').stringify({
|
||
|
type: 'mytype',
|
||
|
id: 'myid',
|
||
|
subtype: 'mysubtype',
|
||
|
version: 'myversion',
|
||
|
index: 'myindex'
|
||
|
});
|
||
|
// 'mytype/myid/mysubtype/myversion/myindex'
|
||
|
```
|
||
|
|
||
|
## Development
|
||
|
To run the unit tests:
|
||
|
```shell
|
||
|
npm test
|
||
|
```
|
||
|
|
||
|
For JShint:
|
||
|
```shell
|
||
|
npm run jshint
|
||
|
```
|
||
|
|
||
|
## License
|
||
|
Copyright (c) 2014 Johannes J. Schmidt, null2 GmbH
|
||
|
Licensed under the MIT license.
|
||
|
|