New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-uuid

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-uuid - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

index.mjs

3

dist/index.esm.js

@@ -44,3 +44,2 @@ import { v1, v3, v4, v5 } from 'uuid';

export default install;
export { uuid };
export { install as default, uuid };

@@ -48,3 +48,3 @@ 'use strict';

exports.default = install;
exports["default"] = install;
exports.uuid = uuid;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto')) :
typeof define === 'function' && define.amd ? define(['exports', 'crypto'], factory) :
(global = global || self, factory(global.VueUUID = {}, global.crypto));
}(this, (function (exports, crypto) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('uuid')) :
typeof define === 'function' && define.amd ? define(['exports', 'uuid'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VueUUID = {}, global.uuid$1));
})(this, (function (exports, uuid$1) { 'use strict';
crypto = crypto && Object.prototype.hasOwnProperty.call(crypto, 'default') ? crypto['default'] : crypto;
const rnds8 = new Uint8Array(16);
function rng() {
return crypto.randomFillSync(rnds8);
}
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
const byteToHex = [];
for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).substr(1));
}
function bytesToUuid(buf, offset) {
const i = offset || 0;
const bth = byteToHex; // Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
return (bth[buf[i + 0]] + bth[buf[i + 1]] + bth[buf[i + 2]] + bth[buf[i + 3]] + '-' + bth[buf[i + 4]] + bth[buf[i + 5]] + '-' + bth[buf[i + 6]] + bth[buf[i + 7]] + '-' + bth[buf[i + 8]] + bth[buf[i + 9]] + '-' + bth[buf[i + 10]] + bth[buf[i + 11]] + bth[buf[i + 12]] + bth[buf[i + 13]] + bth[buf[i + 14]] + bth[buf[i + 15]]).toLowerCase();
}
//
// Inspired by https://github.com/LiosK/UUID.js
// and http://docs.python.org/library/uuid.html
let _nodeId;
let _clockseq; // Previous uuid creation time
let _lastMSecs = 0;
let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
function v1(options, buf, offset) {
let i = buf && offset || 0;
const b = buf || [];
options = options || {};
let node = options.node || _nodeId;
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
// specified. We do this lazily to minimize issues related to insufficient
// system entropy. See #189
if (node == null || clockseq == null) {
const seedBytes = options.random || (options.rng || rng)();
if (node == null) {
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
}
if (clockseq == null) {
// Per 4.2.2, randomize (14 bit) clockseq
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
}
} // 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.
let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
// cycle to simulate higher resolution clock
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
const 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`
const 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`
const 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`
for (let n = 0; n < 6; ++n) {
b[i + n] = node[n];
}
return buf || bytesToUuid(b);
}
function uuidToBytes(uuid) {
// Note: We assume we're being passed a valid uuid string
const bytes = [];
uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
bytes.push(parseInt(hex, 16));
});
return bytes;
}
function stringToBytes(str) {
str = unescape(encodeURIComponent(str)); // UTF8 escape
const bytes = [];
for (let i = 0; i < str.length; ++i) {
bytes.push(str.charCodeAt(i));
}
return bytes;
}
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
function v35 (name, version, hashfunc) {
function generateUUID(value, namespace, buf, offset) {
const off = buf && offset || 0;
if (typeof value === 'string') value = stringToBytes(value);
if (typeof namespace === 'string') namespace = uuidToBytes(namespace);
if (!Array.isArray(value)) {
throw TypeError('value must be an array of bytes');
}
if (!Array.isArray(namespace) || namespace.length !== 16) {
throw TypeError('namespace must be uuid string or an Array of 16 byte values');
} // Per 4.3
const bytes = hashfunc(namespace.concat(value));
bytes[6] = bytes[6] & 0x0f | version;
bytes[8] = bytes[8] & 0x3f | 0x80;
if (buf) {
for (let idx = 0; idx < 16; ++idx) {
buf[off + idx] = bytes[idx];
}
}
return buf || bytesToUuid(bytes);
} // Function#name is not settable on some platforms (#270)
try {
generateUUID.name = name; // eslint-disable-next-line no-empty
} catch (err) {} // For CommonJS default export support
generateUUID.DNS = DNS;
generateUUID.URL = URL;
return generateUUID;
}
function md5(bytes) {
if (Array.isArray(bytes)) {
bytes = Buffer.from(bytes);
} else if (typeof bytes === 'string') {
bytes = Buffer.from(bytes, 'utf8');
}
return crypto.createHash('md5').update(bytes).digest();
}
const v3 = v35('v3', 0x30, md5);
function v4(options, buf, offset) {
if (typeof options === 'string') {
buf = options === 'binary' ? new Uint8Array(16) : null;
options = null;
}
options = options || {};
const rnds = options.random || (options.rng || rng)(); // 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) {
const start = offset || 0;
for (let i = 0; i < 16; ++i) {
buf[start + i] = rnds[i];
}
return buf;
}
return bytesToUuid(rnds);
}
function sha1(bytes) {
if (Array.isArray(bytes)) {
bytes = Buffer.from(bytes);
} else if (typeof bytes === 'string') {
bytes = Buffer.from(bytes, 'utf8');
}
return crypto.createHash('sha1').update(bytes).digest();
}
const v5 = v35('v5', 0x50, sha1);
/**
* @typedef {Object} UUID

@@ -249,6 +21,6 @@ * @property {typeof v1} v1

var uuid = {
v1: v1,
v3: v3,
v4: v4,
v5: v5
v1: uuid$1.v1,
v3: uuid$1.v3,
v4: uuid$1.v4,
v5: uuid$1.v5
};

@@ -277,3 +49,3 @@ /**

exports.default = install;
exports["default"] = install;
exports.uuid = uuid;

@@ -283,2 +55,2 @@

})));
}));

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("crypto")):"function"==typeof define&&define.amd?define(["exports","crypto"],t):t((e=e||self).VueUUID={},e.crypto)}(this,(function(e,t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;const r=new Uint8Array(16);function n(){return t.randomFillSync(r)}const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).substr(1));function u(e,t){const r=t||0,n=o;return(n[e[r+0]]+n[e[r+1]]+n[e[r+2]]+n[e[r+3]]+"-"+n[e[r+4]]+n[e[r+5]]+"-"+n[e[r+6]]+n[e[r+7]]+"-"+n[e[r+8]]+n[e[r+9]]+"-"+n[e[r+10]]+n[e[r+11]]+n[e[r+12]]+n[e[r+13]]+n[e[r+14]]+n[e[r+15]]).toLowerCase()}let c,s,f=0,i=0;function a(e,t,r){function n(e,n,o,c){const s=o&&c||0;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=function(e){const t=[];return e.replace(/[a-fA-F0-9]{2}/g,(function(e){t.push(parseInt(e,16))})),t}(n)),!Array.isArray(e))throw TypeError("value must be an array of bytes");if(!Array.isArray(n)||16!==n.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");const f=r(n.concat(e));if(f[6]=15&f[6]|t,f[8]=63&f[8]|128,o)for(let e=0;e<16;++e)o[s+e]=f[e];return o||u(f)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}var d={v1:function(e,t,r){let o=t&&r||0;const a=t||[];let d=(e=e||{}).node||c,l=void 0!==e.clockseq?e.clockseq:s;if(null==d||null==l){const t=e.random||(e.rng||n)();null==d&&(d=c=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==l&&(l=s=16383&(t[6]<<8|t[7]))}let y=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:i+1;const m=y-f+(p-i)/1e4;if(m<0&&void 0===e.clockseq&&(l=l+1&16383),(m<0||y>f)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=y,i=p,s=l,y+=122192928e5;const h=(1e4*(268435455&y)+p)%4294967296;a[o++]=h>>>24&255,a[o++]=h>>>16&255,a[o++]=h>>>8&255,a[o++]=255&h;const v=y/4294967296*1e4&268435455;a[o++]=v>>>8&255,a[o++]=255&v,a[o++]=v>>>24&15|16,a[o++]=v>>>16&255,a[o++]=l>>>8|128,a[o++]=255&l;for(let e=0;e<6;++e)a[o+e]=d[e];return t||u(a)},v3:a("v3",48,(function(e){return Array.isArray(e)?e=Buffer.from(e):"string"==typeof e&&(e=Buffer.from(e,"utf8")),t.createHash("md5").update(e).digest()})),v4:function(e,t,r){"string"==typeof e&&(t="binary"===e?new Uint8Array(16):null,e=null);const o=(e=e||{}).random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){const e=r||0;for(let r=0;r<16;++r)t[e+r]=o[r];return t}return u(o)},v5:a("v5",80,(function(e){return Array.isArray(e)?e=Buffer.from(e):"string"==typeof e&&(e=Buffer.from(e,"utf8")),t.createHash("sha1").update(e).digest()}))};e.default=function(e){e.prototype.$uuid=d},e.uuid=d,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,u){"object"==typeof exports&&"undefined"!=typeof module?u(exports,require("uuid")):"function"==typeof define&&define.amd?define(["exports","uuid"],u):u((e="undefined"!=typeof globalThis?globalThis:e||self).VueUUID={},e.uuid$1)}(this,(function(e,u){"use strict";var i={v1:u.v1,v3:u.v3,v4:u.v4,v5:u.v5};e.default=function(e){e.prototype.$uuid=i},e.uuid=i,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "vue-uuid",
"version": "2.0.2",
"version": "2.1.0",
"description": "Add UUID to Vue instance.",

@@ -14,3 +14,3 @@ "cdn": "dist/index.umd.min.js",

"test": "ava",
"build": "bili index.js --format es,cjs,umd,umd-min --minimal --moduleName VueUUID",
"build": "bili index.mjs --format esm,cjs,umd,umd-min --moduleName VueUUID",
"prepublishOnly": "npm run build && npm run test"

@@ -38,12 +38,12 @@ },

},
"dependencies": {
"@types/uuid": "^8.3.4",
"uuid": "^8.3.2"
},
"devDependencies": {
"ava": "^3.8.2",
"bili": "^4.10.1",
"ava": "^4.0.1",
"bili": "^5.0.5",
"esm": "^3.2.25",
"vue": "^2.6.11"
},
"dependencies": {
"@types/uuid": "^8.0.0",
"uuid": "^8.1.0"
"vue": "^2.6.14"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc