pauli

0.0.1 • Public • Published

pauli

Generate unique IDs

Installation

pauli is available on npm.

npm install pauli

API

UUID

.uuid ([raw])

  • @param {Boolean} return as buffer (default: false)
  • @returns {String|Buffer}

Generatea v4 compatible UUID. By default, will return the UUID as a string formatted according to xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.

var pauli = require('pauli')
  , uuid = pauli.uuid();
 
console.log(uuid);
// '2c3a0561-847f-4cae-8161-c52908cbcf53'

.uuid.toString(buf)

  • @param {Buffer} buffer to convert
  • @returns String} formatted uuid

Should you have generated a buffer, you can then convert it to a string.

var puali = require('pauli')
  , buf = pauli.uuid(true)
  , uuid = pauli.uuid.toString(buf);
 
console.log(uuid);
// '2c3a0561-847f-4cae-8161-c52908cbcf53'

License

(The MIT License)

Copyright (c) 2012 Jake Luer jake@alogicalparadox.com (http://alogicalparadox.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i pauli

Weekly Downloads

352

Version

0.0.1

License

MIT

Last publish

Collaborators

  • jakeluer