@tybys/oid
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -7,3 +7,5 @@ (function (global, factory) { | ||
function commonjsRequire () { | ||
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); | ||
} | ||
@@ -18,3 +20,3 @@ var nativeRequire; | ||
nativeRequire = (function () { | ||
return typeof __webpack_modules__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof require !== 'undefined' ? require : undefined); | ||
return typeof __webpack_modules__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof commonjsRequire !== 'undefined' ? commonjsRequire : undefined); | ||
})(); | ||
@@ -21,0 +23,0 @@ } |
@@ -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";var e,r={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:"undefined"!=typeof require?require:undefined}.nativeRequire;try{e=r("buffer").Buffer}catch(m){}var n=Object.prototype.toString;function i(t){return"undefined"!=typeof Uint8Array&&t instanceof Uint8Array||function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n.call(t)}(t)}function o(t){if(e)return e.alloc(t);var r;if("undefined"!=typeof Uint8Array)return new Uint8Array(t);var n=[];for(r=0;r<t;r++)n[r]=0;return n}function a(t){if(t=t||0,e&&e.isBuffer(this))return this.readUInt32BE(t);var r=this[t],n=this[t+3];if(r===undefined||n===undefined)throw new RangeError("Attempt to write outside buffer bounds");return r*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+n}function s(t){if(e)return e.from(this).toString(t);var r,n,i,o,a,s="",f=0;if("hex"===t){for(s="",f=0;f<this.length;f++){var c=this[f].toString(16);s+=1===c.length?"0"+c:c}return s}if("binary"===t){for(s="",f=0;f<this.length;f++)s+=String.fromCharCode(this[f]);return s}for(r="",n=this.length,f=0;f<n;)switch((i=this[f++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(i);break;case 12:case 13:o=this[f++],r+=String.fromCharCode((31&i)<<6|63&o);break;case 14:o=this[f++],a=this[f++],r+=String.fromCharCode((15&i)<<12|(63&o)<<6|(63&a)<<0)}return r}function f(t){for(var e=o(t),r=0;r<t;++r)e[r]=Math.floor(256*Math.random());return e}var c=f;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues&&"undefined"!=typeof Uint8Array)c=function(t){return window.crypto.getRandomValues(new Uint8Array(t))};else{try{c=r("crypto").randomBytes}catch(m){}null==c&&(c=f)}function u(t,e){return function(){console.warn(e);var r=Array.prototype.slice.call(arguments);return t.apply(this,r)}}var d,h=c(5),g=new RegExp("^[0-9a-fA-F]{24}$"),p=[];for(d=0;d<256;d++)p[d]=(d<=15?"0":"")+d.toString(16);var y,l=[];for(d=0;d<10;)l[48+d]=d++;for(;d<16;)l[55+d]=l[87+d]=d++;function _(t){if(!(this instanceof _))throw new TypeError("Class constructor ObjectId cannot be invoked without 'new'");if(t instanceof _)return t;if(null==t||"number"==typeof t)return this.id=_.generate(t),void(_.cacheHexString&&(this.__id=this.toString("hex")));var r=_.isValid(t);if(!r&&null!=t)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(r&&"string"==typeof t&&24===t.length&&e)return new _(e.from(t,"hex"));if(r&&"string"==typeof t&&24===t.length)return _.createFromHexString(t);if(null==t||12!==t.length){if(null!=t&&t.toHexString)return _.createFromHexString(t.toHexString());throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}i(t)?this.id=function(t){if(e)return e.from(t);var r;if("undefined"!=typeof Uint8Array){if("function"==typeof Uint8Array.from)return Uint8Array.from(t);var n=new Uint8Array(t.length);for(r=0;r<t.length;r++)n[r]=t[r];return n}var i=[];for(r=0;r<t.length;r++)i[r]=t[r];return i}(t):this.id=t,_.cacheHexString&&(this.__id=this.toString("hex"))}_.prototype.toHexString=function(){if(_.cacheHexString&&this.__id)return this.__id;var t,e,r,n,o="";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(i(this.id))return t=this.id,o=s.call(t,"hex"),_.cacheHexString&&(this.__id=o),o;for(var a=0;a<this.id.length;a++){var f=p[this.id.charCodeAt(a)];if("string"!=typeof f)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.");o+=f}return _.cacheHexString&&(this.__id=o),o},_.getInc=function(){return _.index=(_.index+1)%16777215},_.generate=function(t){"number"!=typeof t&&(t=~~(Date.now()/1e3));var e=_.getInc(),r=o(12);return r[3]=255&t,r[2]=t>>8&255,r[1]=t>>16&255,r[0]=t>>24&255,r[4]=h[0],r[5]=h[1],r[6]=h[2],r[7]=h[3],r[8]=h[4],r[11]=255&e,r[10]=e>>8&255,r[9]=e>>16&255,r},_.prototype.toString=function(t){return i(this.id)?s.call(this.id,"string"==typeof t?t:"hex"):this.toHexString()},_.prototype.toJSON=function(){return this.toHexString()},_.prototype.equals=function(t){return t instanceof _?this.toString()===t.toString():"string"==typeof t&&_.isValid(t)&&12===t.length&&i(this.id)?t===s.call(this.id,"binary"):"string"==typeof t&&_.isValid(t)&&24===t.length?t.toLowerCase()===this.toHexString():"string"==typeof t&&_.isValid(t)&&12===t.length?t===this.id:!(null==t||!(t instanceof _||t.toHexString))&&t.toHexString()===this.toHexString()},_.prototype.getTimestamp=function(){var t=new Date,e=a.call(this.id,0);return t.setTime(1e3*Math.floor(e)),t},_.createPk=function(){return new _},_.createFromTime=function(t){var e=o(12);return e[3]=255&t,e[2]=t>>8&255,e[1]=t>>16&255,e[0]=t>>24&255,new _(e)},_.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=o(12),r=0,n=0;n<24;)e[r++]=l[t.charCodeAt(n++)]<<4|l[t.charCodeAt(n++)];return new _(e)},_.isValid=function(t){return null!=t&&("number"==typeof t||("string"==typeof t?12===t.length||24===t.length&&g.test(t):t instanceof _||(!(!i(t)||12!==t.length)||!!t.toHexString&&(12===t.id.length||24===t.id.length&&g.test(t.id)))))},_.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},_.fromExtendedJSON=function(t){return new _(t.$oid)},_.get_inc=u((function(){return _.getInc()}),"Please use the static `ObjectId.getInc()` instead"),_.prototype.get_inc=u((function(){return _.getInc()}),"Please use the static `ObjectId.getInc()` instead"),_.prototype.getInc=u((function(){return _.getInc()}),"Please use the static `ObjectId.getInc()` instead"),_.prototype.generate=u((function(t){return _.generate(t)}),"Please use the static `ObjectId.generate(time)` instead");try{Object.defineProperty(_.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(S){_.prototype.generationTime=0}try{y=r("util"),_.prototype[y.inspect.custom||"inspect"]=_.prototype.toString}catch(m){_.prototype.inspect=_.prototype.toString}_.index=~~(16777215*Math.random());try{Object.defineProperty(_.prototype,"_bsontype",{value:"ObjectID"})}catch(S){_.prototype._bsontype="ObjectID"}var b=_,w={ObjectId:b};t.ObjectId=b,t["default"]=w,(function(){try{return Object.defineProperty(t,"__esModule",{value:!0})}catch(_){return t.__esModule=!0,t}})()})); | ||
!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}})()})); |
@@ -1,2 +0,2 @@ | ||
var nativeRequire = require('@tybys/native-require').nativeRequire; | ||
var nativeRequire = require('@tybys/native-require/index.js').nativeRequire; | ||
@@ -3,0 +3,0 @@ var __Buffer; |
{ | ||
"name": "@tybys/oid", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"bin": { | ||
@@ -34,9 +34,9 @@ "oid": "./bin/oid.js" | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^11.1.0", | ||
"@rollup/plugin-node-resolve": "^7.1.3", | ||
"@rollup/plugin-commonjs": "^13.0.0", | ||
"@rollup/plugin-node-resolve": "^8.1.0", | ||
"@types/node": "^12.7.5", | ||
"eslint": "^6.8.0", | ||
"mocha": "^7.1.2", | ||
"rollup": "^2.7.2", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"rollup": "^2.18.1", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"should": "^13.2.3", | ||
@@ -48,4 +48,4 @@ "typescript": "^3.8.3", | ||
"dependencies": { | ||
"@tybys/native-require": "^1.1.0" | ||
"@tybys/native-require": "^1.2.0" | ||
} | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
46787
1135
0
0
Updated@tybys/native-require@^1.2.0