A library for parsing IMAP UID ranges.
var uidRanger = require('uid-ranger');
var range = uidRanger.parse('5694:5696,5712,5715:5717');
expect(range.toString(), 'to equal', '5694:5696,5712,5715:5717');
expect(range.toArray(), 'to equal', [5694, 5695, 5696, 5712, 5715, 5716, 5717]);
expect(range.length(), 'to equal', 7);
expect(range.get(1), 'to equal', 5694);
expect(range.get(3), 'to equal', 5712);
Install it with NPM or add it to your package.json
:
$ npm install uidRanger
Then:
var uidRanger = require('uid-ranger');
Include uidRanger.js
.
<script src="uidRanger.js"></script>
this will expose the expect function under the following namespace:
var uidRanger = one.uidRanger;
Include the library with RequireJS the following way:
require.config({
paths: {
uidRanger: 'path/to/uidRanger'
}
});
define(['uidRanger'], function (uidRanger) {
// Your code
});