Socket
Socket
Sign inDemoInstall

detritus-utils

Package Overview
Dependencies
1
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0 to 0.4.0

2

lib/constants.js

@@ -6,5 +6,5 @@ "use strict";

URL: 'https://github.com/detritusjs/utils',
VERSION: '0.3.0',
VERSION: '0.4.0',
});
exports.DISCORD_SNOWFLAKE_EPOCH = 1420070400000;
exports.DISCORD_TOKEN_EPOCH = 1293840000000;

@@ -10,3 +10,3 @@ "use strict";

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};

@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -34,5 +34,5 @@ "use strict";

const epoch = BigInt(options.epoch);
const processId = BigInt(options.processId);
const timestamp = BigInt(options.timestamp);
const workerId = BigInt(options.workerId);
const processId = BigInt(options.processId) & max.processId;
const timestamp = (BigInt(options.timestamp) - epoch) % max.timestamp;
const workerId = BigInt(options.workerId) & max.workerId;
let sequence;

@@ -47,10 +47,10 @@ if (options.sequence === undefined) {

id: '',
processId: Number(processId & max.processId),
processId: Number(processId),
sequence: Number(sequence),
timestamp: Number((timestamp - epoch) % max.timestamp),
workerId: Number(workerId & max.workerId),
timestamp: Number(timestamp),
workerId: Number(workerId),
};
snowflake.id = String((timestamp << shift.timestamp) |
(workerId << shift.workerId) |
(processId << shift.processId) |
(workerId << shift.workerId) |
(sequence << shift.sequence));

@@ -57,0 +57,0 @@ return snowflake;

{
"name": "detritus-utils",
"version": "0.3.0",
"version": "0.4.0",
"description": "Detritus Utils",

@@ -12,6 +12,6 @@ "main": "lib/index.js",

"devDependencies": {
"@types/node": "^14.0.27"
"@types/node": "^14.14.22"
},
"peerDependencies": {
"eventemitter3": "^4.0.4"
"eventemitter3": "^4.0.7"
},

@@ -33,3 +33,2 @@ "peerDependenciesMeta": {

"keywords": [
"rest",
"detritus",

@@ -36,0 +35,0 @@ "nodejs",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc