+
+
{{ uuid }}
+
+
+
+
+
+
+```
diff --git a/dist/vue-uuid.common.js b/dist/vue-uuid.common.js
new file mode 100644
index 0000000..f529f08
--- /dev/null
+++ b/dist/vue-uuid.common.js
@@ -0,0 +1,11 @@
+'use strict';
+
+function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
+
+var uuid = _interopDefault(require('uuid'));
+
+var install = function (Vue) {
+ Vue.prototype.$uuid = uuid;
+};
+
+module.exports = install;
diff --git a/dist/vue-uuid.js b/dist/vue-uuid.js
new file mode 100644
index 0000000..331db89
--- /dev/null
+++ b/dist/vue-uuid.js
@@ -0,0 +1,182 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('crypto')) :
+ typeof define === 'function' && define.amd ? define(['crypto'], factory) :
+ (global.vueUuid = factory(global.crypto));
+}(this, (function (crypto) { 'use strict';
+
+crypto = crypto && crypto.hasOwnProperty('default') ? crypto['default'] : crypto;
+
+// Unique ID creation requires a high quality random # generator. In node.js
+// this is pretty straight-forward - we use the crypto API.
+
+var rb = crypto.randomBytes;
+
+function rng() {
+ return rb(16);
+}
+
+var rng_1 = rng;
+
+/**
+ * Convert array of 16 byte values to UUID string format of the form:
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+ */
+var byteToHex = [];
+for (var i = 0; i < 256; ++i) {
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
+}
+
+function bytesToUuid(buf, offset) {
+ var i = offset || 0;
+ var bth = byteToHex;
+ return bth[buf[i++]] + bth[buf[i++]] +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] +
+ bth[buf[i++]] + bth[buf[i++]] +
+ bth[buf[i++]] + bth[buf[i++]];
+}
+
+var bytesToUuid_1 = bytesToUuid;
+
+// **`v1()` - Generate time-based UUID**
+//
+// Inspired by https://github.com/LiosK/UUID.js
+// and http://docs.python.org/library/uuid.html
+
+// random #'s we need to init node and clockseq
+var _seedBytes = rng_1();
+
+// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
+var _nodeId = [
+ _seedBytes[0] | 0x01,
+ _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
+];
+
+// Per 4.2.2, randomize (14 bit) clockseq
+var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
+
+// Previous uuid creation time
+var _lastMSecs = 0;
+var _lastNSecs = 0;
+
+// See https://github.com/broofa/node-uuid for API details
+function v1(options, buf, offset) {
+ var i = buf && offset || 0;
+ var b = buf || [];
+
+ options = options || {};
+
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
+
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
+
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
+ // cycle to simulate higher resolution clock
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
+
+ // Time since last uuid creation (in msecs)
+ var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
+
+ // Per 4.2.1.2, Bump clockseq on clock regression
+ if (dt < 0 && options.clockseq === undefined) {
+ clockseq = clockseq + 1 & 0x3fff;
+ }
+
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
+ // time interval
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
+ nsecs = 0;
+ }
+
+ // Per 4.2.1.2 Throw error if too many uuids are requested
+ if (nsecs >= 10000) {
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
+ }
+
+ _lastMSecs = msecs;
+ _lastNSecs = nsecs;
+ _clockseq = clockseq;
+
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
+ msecs += 12219292800000;
+
+ // `time_low`
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
+ b[i++] = tl >>> 24 & 0xff;
+ b[i++] = tl >>> 16 & 0xff;
+ b[i++] = tl >>> 8 & 0xff;
+ b[i++] = tl & 0xff;
+
+ // `time_mid`
+ var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
+ b[i++] = tmh >>> 8 & 0xff;
+ b[i++] = tmh & 0xff;
+
+ // `time_high_and_version`
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
+ b[i++] = tmh >>> 16 & 0xff;
+
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
+ b[i++] = clockseq >>> 8 | 0x80;
+
+ // `clock_seq_low`
+ b[i++] = clockseq & 0xff;
+
+ // `node`
+ var node = options.node || _nodeId;
+ for (var n = 0; n < 6; ++n) {
+ b[i + n] = node[n];
+ }
+
+ return buf ? buf : bytesToUuid_1(b);
+}
+
+var v1_1 = v1;
+
+function v4(options, buf, offset) {
+ var i = buf && offset || 0;
+
+ if (typeof(options) == 'string') {
+ buf = options == 'binary' ? new Array(16) : null;
+ options = null;
+ }
+ options = options || {};
+
+ var rnds = options.random || (options.rng || rng_1)();
+
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
+
+ // Copy bytes to buffer, if provided
+ if (buf) {
+ for (var ii = 0; ii < 16; ++ii) {
+ buf[i + ii] = rnds[ii];
+ }
+ }
+
+ return buf || bytesToUuid_1(rnds);
+}
+
+var v4_1 = v4;
+
+var uuid = v4_1;
+uuid.v1 = v1_1;
+uuid.v4 = v4_1;
+
+var uuid_1 = uuid;
+
+var install = function (Vue) {
+ Vue.prototype.$uuid = uuid_1;
+};
+
+return install;
+
+})));
diff --git a/dist/vue-uuid.min.js b/dist/vue-uuid.min.js
new file mode 100644
index 0000000..cc30463
--- /dev/null
+++ b/dist/vue-uuid.min.js
@@ -0,0 +1,2 @@
+!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],r):e.vueUuid=r(e.crypto)}(this,function(e){"use strict";for(var r=(e=e&&e.hasOwnProperty("default")?e.default:e).randomBytes,n=function(){return r(16)},t=[],o=0;o<256;++o)t[o]=(o+256).toString(16).substr(1);var u=function(e,r){var n=r||0,o=t;return o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]},i=n(),c=[1|i[0],i[1],i[2],i[3],i[4],i[5]],s=16383&(i[6]<<8|i[7]),a=0,f=0,d=function(e,r,t){var o=r&&t||0;"string"==typeof e&&(r="binary"==e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||n)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,r)for(var c=0;c<16;++c)r[o+c]=i[c];return r||u(i)},v=d;v.v1=function(e,r,n){var t=r&&n||0,o=r||[],i=void 0!==(e=e||{}).clockseq?e.clockseq:s,d=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:f+1,p=d-a+(v-f)/1e4;if(p<0&&void 0===e.clockseq&&(i=i+1&16383),(p<0||d>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=d,f=v,s=i;var y=(1e4*(268435455&(d+=122192928e5))+v)%4294967296;o[t++]=y>>>24&255,o[t++]=y>>>16&255,o[t++]=y>>>8&255,o[t++]=255&y;var l=d/4294967296*1e4&268435455;o[t++]=l>>>8&255,o[t++]=255&l,o[t++]=l>>>24&15|16,o[t++]=l>>>16&255,o[t++]=i>>>8|128,o[t++]=255&i;for(var m=e.node||c,w=0;w<6;++w)o[t+w]=m[w];return r||u(o)},v.v4=d;var p=v;return function(e){e.prototype.$uuid=p}});
+//# sourceMappingURL=vue-uuid.min.js.map
diff --git a/dist/vue-uuid.min.js.map b/dist/vue-uuid.min.js.map
new file mode 100644
index 0000000..5aaf3dd
--- /dev/null
+++ b/dist/vue-uuid.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"vue-uuid.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..3a86b46
--- /dev/null
+++ b/index.js
@@ -0,0 +1,7 @@
+import uuid from 'uuid'
+
+const install = (Vue) => {
+ Vue.prototype.$uuid = uuid
+}
+
+export default install
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..3346a93
--- /dev/null
+++ b/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "vue-uuid",
+ "version": "0.1.0",
+ "description": "Add UUID to Vue instance.",
+ "main": "dist/index.common.js",
+ "module": "index.js",
+ "scripts": {
+ "test": "standard",
+ "build": "bili ./index.js -o dist --format cjs --format umd --compress umd",
+ "prepare": "npm run build"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/VitorLuizC/vue-uuid.git"
+ },
+ "keywords": [
+ "vue",
+ "vue-uuid",
+ "uuid"
+ ],
+ "author": "Vitor Luiz Cavalcanti",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/VitorLuizC/vue-uuid/issues"
+ },
+ "homepage": "https://github.com/VitorLuizC/vue-uuid#README",
+ "devDependencies": {
+ "bili": "^0.18.2",
+ "standard": "^10.0.3"
+ },
+ "dependencies": {
+ "uuid": "^3.1.0"
+ },
+ "standard": {
+ "ignore": ["dist/**"]
+ }
+}