Skip to content

Support integers as well as strings #6

Description

@nolanlawson

This library is amazing, but it would be neat if I could also do:

docuri.stringify({
  type: 'mytype',
  id: 'myid',
  subtype: 'mysubtype',
  index: 'myindex',
  version: 1
});

If you require the pouchdb-collate project, you could accomplish this:

var collate = require('pouchdb-collate');
collate.toIndexableString(2) < collate.toIndexableString(10); // true

In fact you could even stringify booleans or arrays or whatever you want. Ordering will be different for strings in PouchDB (ASCII vs ICU), but for numbers and booleans it should be the same across both. Then you could support semver:

docuri.stringify({
  type: 'mytype',
  id: 'myid',
  subtype: 'mysubtype',
  index: 'myindex',
  version: [1, 10, 2]
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions