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

@tybys/oid

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tybys/oid - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

113

dist/oid.js

@@ -7,25 +7,104 @@ (function (global, factory) {

function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var nativeRequire;
if (typeof __webpack_modules__ !== 'undefined') {
nativeRequire = typeof __tybys_get_native_require__ === 'function' ? __tybys_get_native_require__() : (function () {
return typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined;
})();
} else {
nativeRequire = (function () {
return typeof __webpack_modules__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof commonjsRequire !== 'undefined' ? commonjsRequire : undefined);
})();
}
var nativeRequire_1 = (function getRequireFunction (parentModule) {
var nativeRequire;
var nativeRequire_2 = nativeRequire;
if (typeof __webpack_modules__ !== 'undefined') {
nativeRequire = typeof __tybys_get_native_require__ === 'function' ? __tybys_get_native_require__() : (function () {
return typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined;
})();
} else {
nativeRequire = (function () {
return typeof __webpack_modules__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof require !== 'undefined' ? require : undefined);
})();
}
var nativeRequire_1 = {
nativeRequire: nativeRequire_2
if (typeof nativeRequire === 'function') {
var g = (function (defaultValue) {
var g;
g = (function () { return this; })(); // non-strict mode
try {
g = g || new Function("return this")(); // allow eval
} catch (_) {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof __webpack_modules__ === "undefined") {
if (typeof commonjsGlobal !== "undefined") return commonjsGlobal;
}
if (typeof window !== "undefined") return window;
if (typeof self !== "undefined") return self;
}
return g || defaultValue;
})();
if (!(g && g.process && g.process.versions && typeof g.process.versions.node === 'string')) {
return nativeRequire;
}
if (nativeRequire === g.require) {
return nativeRequire;
}
var Module;
try {
Module = nativeRequire('module');
} catch (_) {
return nativeRequire;
}
Module = Module || Module.Module;
if (!Module || !(parentModule instanceof Module)) {
return nativeRequire;
}
if (typeof Module.createRequire === 'function') {
return Module.createRequire(parentModule.filename);
}
if (typeof Module.createRequireFromPath === 'function') {
return Module.createRequireFromPath(parentModule.filename);
}
return (function makeRequireFunction (mod, main) {
var Module = mod.constructor;
function require (path) {
return mod.require(path);
}
function validateString (value, name) {
if (typeof value !== 'string') throw new TypeError('The "' + name + '" argument must be of type string. Received type ' + typeof value);
}
function resolve (request, opts) {
validateString(request, 'request');
return Module._resolveFilename(request, mod, false, opts);
}
require.resolve = resolve;
function paths (request) {
validateString(request, 'request');
return Module._resolveLookupPaths(request, mod);
}
resolve.paths = paths;
require.main = main;
require.extensions = Module._extensions;
require.cache = Module._cache;
return require;
})(parentModule, (g.process.mainModule instanceof Module) ? g.process.mainModule : undefined);
}
return nativeRequire;
})();
var nativeRequire = {
nativeRequire: nativeRequire_1
};
var nativeRequire$1 = nativeRequire_1.nativeRequire;
var nativeRequire$1 = nativeRequire.nativeRequire;

@@ -32,0 +111,0 @@ var __Buffer;

2

dist/oid.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).oid={})}(this,(function(t){"use strict";function e(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var r,n={nativeRequire:"undefined"!=typeof __webpack_modules__?"function"==typeof __tybys_get_native_require__?__tybys_get_native_require__():"undefined"!=typeof __non_webpack_require__?__non_webpack_require__:undefined:"undefined"!=typeof __webpack_modules__?"undefined"!=typeof __non_webpack_require__?__non_webpack_require__:undefined:void 0!==e?e:undefined}.nativeRequire;try{r=n("buffer").Buffer}catch(S){}var i=Object.prototype.toString;function o(t){return"undefined"!=typeof Uint8Array&&t instanceof Uint8Array||function(t){return Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)}(t)}function a(t){if(r)return r.alloc(t);var e;if("undefined"!=typeof Uint8Array)return new Uint8Array(t);var n=[];for(e=0;e<t;e++)n[e]=0;return n}function s(t){if(t=t||0,r&&r.isBuffer(this))return this.readUInt32BE(t);var e=this[t],n=this[t+3];if(e===undefined||n===undefined)throw new RangeError("Attempt to write outside buffer bounds");return e*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+n}function c(t){if(r)return r.from(this).toString(t);var e,n,i,o,a,s="",c=0;if("hex"===t){for(s="",c=0;c<this.length;c++){var f=this[c].toString(16);s+=1===f.length?"0"+f:f}return s}if("binary"===t){for(s="",c=0;c<this.length;c++)s+=String.fromCharCode(this[c]);return s}for(e="",n=this.length,c=0;c<n;)switch((i=this[c++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=String.fromCharCode(i);break;case 12:case 13:o=this[c++],e+=String.fromCharCode((31&i)<<6|63&o);break;case 14:o=this[c++],a=this[c++],e+=String.fromCharCode((15&i)<<12|(63&o)<<6|(63&a)<<0)}return e}function f(t){for(var e=a(t),r=0;r<t;++r)e[r]=Math.floor(256*Math.random());return e}var u=f;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues&&"undefined"!=typeof Uint8Array)u=function(t){return window.crypto.getRandomValues(new Uint8Array(t))};else{try{u=n("crypto").randomBytes}catch(S){}null==u&&(u=f)}function d(t,e){return function(){console.warn(e);var r=Array.prototype.slice.call(arguments);return t.apply(this,r)}}var h,g=u(5),p=new RegExp("^[0-9a-fA-F]{24}$"),y=[];for(h=0;h<256;h++)y[h]=(h<=15?"0":"")+h.toString(16);var l,_=[];for(h=0;h<10;)_[48+h]=h++;for(;h<16;)_[55+h]=_[87+h]=h++;function w(t){if(!(this instanceof w))throw new TypeError("Class constructor ObjectId cannot be invoked without 'new'");if(t instanceof w)return t;if(null==t||"number"==typeof t)return this.id=w.generate(t),void(w.cacheHexString&&(this.__id=this.toString("hex")));var e=w.isValid(t);if(!e&&null!=t)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(e&&"string"==typeof t&&24===t.length&&r)return new w(r.from(t,"hex"));if(e&&"string"==typeof t&&24===t.length)return w.createFromHexString(t);if(null==t||12!==t.length){if(null!=t&&t.toHexString)return w.createFromHexString(t.toHexString());throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}o(t)?this.id=function(t){if(r)return r.from(t);var e;if("undefined"!=typeof Uint8Array){if("function"==typeof Uint8Array.from)return Uint8Array.from(t);var n=new Uint8Array(t.length);for(e=0;e<t.length;e++)n[e]=t[e];return n}var i=[];for(e=0;e<t.length;e++)i[e]=t[e];return i}(t):this.id=t,w.cacheHexString&&(this.__id=this.toString("hex"))}w.prototype.toHexString=function(){if(w.cacheHexString&&this.__id)return this.__id;var t,e,r,n,i="";if(!this.id||!this.id.length)throw new TypeError("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(o(this.id))return t=this.id,i=c.call(t,"hex"),w.cacheHexString&&(this.__id=i),i;for(var a=0;a<this.id.length;a++){var s=y[this.id.charCodeAt(a)];if("string"!=typeof s)throw e=this.id,n=void 0,n=e[r=a],new TypeError('ObjectId string "'+e+'" contains invalid character "'+n+'" with character code ('+e.charCodeAt(r)+"). All character codes for a non-hex string must be less than 256.");i+=s}return w.cacheHexString&&(this.__id=i),i},w.getInc=function(){return w.index=(w.index+1)%16777215},w.generate=function(t){"number"!=typeof t&&(t=~~(Date.now()/1e3));var e=w.getInc(),r=a(12);return r[3]=255&t,r[2]=t>>8&255,r[1]=t>>16&255,r[0]=t>>24&255,r[4]=g[0],r[5]=g[1],r[6]=g[2],r[7]=g[3],r[8]=g[4],r[11]=255&e,r[10]=e>>8&255,r[9]=e>>16&255,r},w.prototype.toString=function(t){return o(this.id)?c.call(this.id,"string"==typeof t?t:"hex"):this.toHexString()},w.prototype.toJSON=function(){return this.toHexString()},w.prototype.equals=function(t){return t instanceof w?this.toString()===t.toString():"string"==typeof t&&w.isValid(t)&&12===t.length&&o(this.id)?t===c.call(this.id,"binary"):"string"==typeof t&&w.isValid(t)&&24===t.length?t.toLowerCase()===this.toHexString():"string"==typeof t&&w.isValid(t)&&12===t.length?t===this.id:!(null==t||!(t instanceof w||t.toHexString))&&t.toHexString()===this.toHexString()},w.prototype.getTimestamp=function(){var t=new Date,e=s.call(this.id,0);return t.setTime(1e3*Math.floor(e)),t},w.createPk=function(){return new w},w.createFromTime=function(t){var e=a(12);return e[3]=255&t,e[2]=t>>8&255,e[1]=t>>16&255,e[0]=t>>24&255,new w(e)},w.createFromHexString=function(t){if(void 0===t||null!=t&&24!==t.length)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");for(var e=a(12),r=0,n=0;n<24;)e[r++]=_[t.charCodeAt(n++)]<<4|_[t.charCodeAt(n++)];return new w(e)},w.isValid=function(t){return null!=t&&("number"==typeof t||("string"==typeof t?12===t.length||24===t.length&&p.test(t):t instanceof w||(!(!o(t)||12!==t.length)||!!t.toHexString&&(12===t.id.length||24===t.id.length&&p.test(t.id)))))},w.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},w.fromExtendedJSON=function(t){return new w(t.$oid)},w.get_inc=d((function(){return w.getInc()}),"Please use the static `ObjectId.getInc()` instead"),w.prototype.get_inc=d((function(){return w.getInc()}),"Please use the static `ObjectId.getInc()` instead"),w.prototype.getInc=d((function(){return w.getInc()}),"Please use the static `ObjectId.getInc()` instead"),w.prototype.generate=d((function(t){return w.generate(t)}),"Please use the static `ObjectId.generate(time)` instead");try{Object.defineProperty(w.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(t){this.id[3]=255&t,this.id[2]=t>>8&255,this.id[1]=t>>16&255,this.id[0]=t>>24&255}})}catch(x){w.prototype.generationTime=0}try{l=n("util"),w.prototype[l.inspect.custom||"inspect"]=w.prototype.toString}catch(S){w.prototype.inspect=w.prototype.toString}w.index=~~(16777215*Math.random());try{Object.defineProperty(w.prototype,"_bsontype",{value:"ObjectID"})}catch(x){w.prototype._bsontype="ObjectID"}var b=w,m={ObjectId:b};t.ObjectId=b,t["default"]=m,(function(){try{return Object.defineProperty(t,"__esModule",{value:!0})}catch(_){return t.__esModule=!0,t}})()}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).oid={})}(this,(function(e){"use strict";var t,n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={nativeRequire:function(e){var t;if("function"==typeof(t="undefined"!=typeof __webpack_modules__?"function"==typeof __tybys_get_native_require__?__tybys_get_native_require__():"undefined"!=typeof __non_webpack_require__?__non_webpack_require__:undefined:"undefined"!=typeof __webpack_modules__?"undefined"!=typeof __non_webpack_require__?__non_webpack_require__:undefined:"undefined"!=typeof require?require:undefined)){var r,i=function(e){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(r){if("undefined"!=typeof globalThis)return globalThis;if("undefined"==typeof __webpack_modules__&&void 0!==n)return n;if("undefined"!=typeof window)return window;if("undefined"!=typeof self)return self}return t||void 0}();if(!(i&&i.process&&i.process.versions&&"string"==typeof i.process.versions.node))return t;if(t===i.require)return t;try{r=t("module")}catch(o){return t}return(r=r||r.Module)&&e instanceof r?"function"==typeof r.createRequire?r.createRequire(e.filename):"function"==typeof r.createRequireFromPath?r.createRequireFromPath(e.filename):function(e,t){var n=e.constructor;function r(t){return e.require(t)}function i(e,t){if("string"!=typeof e)throw new TypeError('The "'+t+'" argument must be of type string. Received type '+typeof e)}function o(t,r){return i(t,"request"),n._resolveFilename(t,e,!1,r)}return r.resolve=o,o.paths=function(t){return i(t,"request"),n._resolveLookupPaths(t,e)},r.main=t,r.extensions=n._extensions,r.cache=n._cache,r}(e,i.process.mainModule instanceof r?i.process.mainModule:undefined):t}return t}()}.nativeRequire;try{t=r("buffer").Buffer}catch(v){}var i=Object.prototype.toString;function o(e){return"undefined"!=typeof Uint8Array&&e instanceof Uint8Array||function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)}(e)}function s(e){if(t)return t.alloc(e);var n;if("undefined"!=typeof Uint8Array)return new Uint8Array(e);var r=[];for(n=0;n<e;n++)r[n]=0;return r}function a(e){if(e=e||0,t&&t.isBuffer(this))return this.readUInt32BE(e);var n=this[e],r=this[e+3];if(n===undefined||r===undefined)throw new RangeError("Attempt to write outside buffer bounds");return n*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+r}function f(e){if(t)return t.from(this).toString(e);var n,r,i,o,s,a="",f=0;if("hex"===e){for(a="",f=0;f<this.length;f++){var u=this[f].toString(16);a+=1===u.length?"0"+u:u}return a}if("binary"===e){for(a="",f=0;f<this.length;f++)a+=String.fromCharCode(this[f]);return a}for(n="",r=this.length,f=0;f<r;)switch((i=this[f++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(i);break;case 12:case 13:o=this[f++],n+=String.fromCharCode((31&i)<<6|63&o);break;case 14:o=this[f++],s=this[f++],n+=String.fromCharCode((15&i)<<12|(63&o)<<6|(63&s)<<0)}return n}function u(e){for(var t=s(e),n=0;n<e;++n)t[n]=Math.floor(256*Math.random());return t}var c=u;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues&&"undefined"!=typeof Uint8Array)c=function(e){return window.crypto.getRandomValues(new Uint8Array(e))};else{try{c=r("crypto").randomBytes}catch(v){}null==c&&(c=u)}function d(e,t){return function(){console.warn(t);var n=Array.prototype.slice.call(arguments);return e.apply(this,n)}}var h,p=c(5),g=new RegExp("^[0-9a-fA-F]{24}$"),l=[];for(h=0;h<256;h++)l[h]=(h<=15?"0":"")+h.toString(16);var y,_=[];for(h=0;h<10;)_[48+h]=h++;for(;h<16;)_[55+h]=_[87+h]=h++;function w(e){if(!(this instanceof w))throw new TypeError("Class constructor ObjectId cannot be invoked without 'new'");if(e instanceof w)return e;if(null==e||"number"==typeof e)return this.id=w.generate(e),void(w.cacheHexString&&(this.__id=this.toString("hex")));var n=w.isValid(e);if(!n&&null!=e)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(n&&"string"==typeof e&&24===e.length&&t)return new w(t.from(e,"hex"));if(n&&"string"==typeof e&&24===e.length)return w.createFromHexString(e);if(null==e||12!==e.length){if(null!=e&&e.toHexString)return w.createFromHexString(e.toHexString());throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}o(e)?this.id=function(e){if(t)return t.from(e);var n;if("undefined"!=typeof Uint8Array){if("function"==typeof Uint8Array.from)return Uint8Array.from(e);var r=new Uint8Array(e.length);for(n=0;n<e.length;n++)r[n]=e[n];return r}var i=[];for(n=0;n<e.length;n++)i[n]=e[n];return i}(e):this.id=e,w.cacheHexString&&(this.__id=this.toString("hex"))}w.prototype.toHexString=function(){if(w.cacheHexString&&this.__id)return this.__id;var e,t,n,r,i="";if(!this.id||!this.id.length)throw new TypeError("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(o(this.id))return e=this.id,i=f.call(e,"hex"),w.cacheHexString&&(this.__id=i),i;for(var s=0;s<this.id.length;s++){var a=l[this.id.charCodeAt(s)];if("string"!=typeof a)throw t=this.id,r=void 0,r=t[n=s],new TypeError('ObjectId string "'+t+'" contains invalid character "'+r+'" with character code ('+t.charCodeAt(n)+"). All character codes for a non-hex string must be less than 256.");i+=a}return w.cacheHexString&&(this.__id=i),i},w.getInc=function(){return w.index=(w.index+1)%16777215},w.generate=function(e){"number"!=typeof e&&(e=~~(Date.now()/1e3));var t=w.getInc(),n=s(12);return n[3]=255&e,n[2]=e>>8&255,n[1]=e>>16&255,n[0]=e>>24&255,n[4]=p[0],n[5]=p[1],n[6]=p[2],n[7]=p[3],n[8]=p[4],n[11]=255&t,n[10]=t>>8&255,n[9]=t>>16&255,n},w.prototype.toString=function(e){return o(this.id)?f.call(this.id,"string"==typeof e?e:"hex"):this.toHexString()},w.prototype.toJSON=function(){return this.toHexString()},w.prototype.equals=function(e){return e instanceof w?this.toString()===e.toString():"string"==typeof e&&w.isValid(e)&&12===e.length&&o(this.id)?e===f.call(this.id,"binary"):"string"==typeof e&&w.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&w.isValid(e)&&12===e.length?e===this.id:!(null==e||!(e instanceof w||e.toHexString))&&e.toHexString()===this.toHexString()},w.prototype.getTimestamp=function(){var e=new Date,t=a.call(this.id,0);return e.setTime(1e3*Math.floor(t)),e},w.createPk=function(){return new w},w.createFromTime=function(e){var t=s(12);return t[3]=255&e,t[2]=e>>8&255,t[1]=e>>16&255,t[0]=e>>24&255,new w(t)},w.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");for(var t=s(12),n=0,r=0;r<24;)t[n++]=_[e.charCodeAt(r++)]<<4|_[e.charCodeAt(r++)];return new w(t)},w.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&g.test(e):e instanceof w||(!(!o(e)||12!==e.length)||!!e.toHexString&&(12===e.id.length||24===e.id.length&&g.test(e.id)))))},w.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},w.fromExtendedJSON=function(e){return new w(e.$oid)},w.get_inc=d((function(){return w.getInc()}),"Please use the static `ObjectId.getInc()` instead"),w.prototype.get_inc=d((function(){return w.getInc()}),"Please use the static `ObjectId.getInc()` instead"),w.prototype.getInc=d((function(){return w.getInc()}),"Please use the static `ObjectId.getInc()` instead"),w.prototype.generate=d((function(e){return w.generate(e)}),"Please use the static `ObjectId.generate(time)` instead");try{Object.defineProperty(w.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(e){this.id[3]=255&e,this.id[2]=e>>8&255,this.id[1]=e>>16&255,this.id[0]=e>>24&255}})}catch(S){w.prototype.generationTime=0}try{y=r("util"),w.prototype[y.inspect.custom||"inspect"]=w.prototype.toString}catch(v){w.prototype.inspect=w.prototype.toString}w.index=~~(16777215*Math.random());try{Object.defineProperty(w.prototype,"_bsontype",{value:"ObjectID"})}catch(S){w.prototype._bsontype="ObjectID"}var b=w,m={ObjectId:b};e.ObjectId=b,e["default"]=m,(function(){try{return Object.defineProperty(e,"__esModule",{value:!0})}catch(_){return e.__esModule=!0,e}})()}));
{
"name": "@tybys/oid",
"version": "2.0.1",
"version": "2.0.2",
"bin": {

@@ -47,4 +47,4 @@ "oid": "./bin/oid.js"

"dependencies": {
"@tybys/native-require": "^1.2.0"
"@tybys/native-require": "^1.3.1"
}
}

@@ -5,4 +5,4 @@ # oid-js

* `dist/oid.js`: 17KB
* `dist/oid.min.js`: 7KB
* `dist/oid.js`: 20KB
* `dist/oid.min.js`: 8KB

@@ -34,9 +34,6 @@ ## Usage

``` html
<script src="node_modules/@tybys/oid/index.js"></script>
<!-- or -->
<!-- <script src="node_modules/@tybys/oid/dist/oid.min.js"></script> -->
<!-- or end -->
<script src="https://cdn.jsdelivr.net/npm/@tybys/oid/dist/oid.min.js"></script>
<script>
console.log(new oid.ObjectId());
console.log(new oid.ObjectId().toHexString());
</script>

@@ -43,0 +40,0 @@ ```

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