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

hyperid

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperid - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

22

hyperid.js
'use strict'
const uuid = require('uuid/v4')
const { v4: uuidv4 } = require('uuid')
const parser = require('uuid-parse')

@@ -9,4 +9,4 @@ const maxInt = Math.pow(2, 31) - 1

function hyperid (opts) {
var fixedLength = false
var urlSafe = false
let fixedLength = false
let urlSafe = false
if (typeof opts === 'boolean') {

@@ -20,7 +20,7 @@ fixedLength = opts

generate.uuid = uuid()
generate.uuid = uuidv4()
generate.decode = decode
var id = baseId(generate.uuid, urlSafe)
var count = Math.floor(opts.startFrom || 0)
let id = baseId(generate.uuid, urlSafe)
let count = Math.floor(opts.startFrom || 0)

@@ -38,3 +38,3 @@ if (isNaN(count) || !(maxInt > count && count >= 0)) {

function generate () {
var result = fixedLength
const result = fixedLength
? id + pad(count++)

@@ -44,3 +44,3 @@ : id + count++

if (count === maxInt) {
generate.uuid = uuid()
generate.uuid = uuidv4()
id = baseId(generate.uuid, urlSafe) // rebase

@@ -68,4 +68,4 @@ count = 0

function baseId (id, urlSafe) {
var base64Id = Buffer.from(parser.parse(id)).toString('base64')
var l = base64Id.length
let base64Id = Buffer.from(parser.parse(id)).toString('base64')
const l = base64Id.length
if (urlSafe) {

@@ -85,3 +85,3 @@ if (base64Id[l - 2] === '=' && base64Id[l - 1] === '=') {

opts = opts || {}
var urlSafe = !!opts.urlSafe
const urlSafe = !!opts.urlSafe

@@ -88,0 +88,0 @@ if (urlSafe) {

{
"name": "hyperid",
"version": "2.1.0",
"version": "2.2.0",
"description": "Uber-fast unique id generation, for Node.js and the browser",

@@ -33,3 +33,3 @@ "main": "hyperid",

"bloomfilter": "0.0.18",
"hashids": "^1.2.2",
"hashids": "^2.2.8",
"nanoid": "^3.1.20",

@@ -39,11 +39,11 @@ "nid": "^1.1.0",

"shortid": "^2.2.15",
"standard": "^14.0.0",
"standard": "^16.0.3",
"tap-dot": "^2.0.0",
"tape": "^5.0.0",
"typescript": "^3.8.3"
"typescript": "^4.3.4"
},
"dependencies": {
"uuid": "^3.4.0",
"uuid": "^8.3.2",
"uuid-parse": "^1.1.0"
}
}

@@ -12,3 +12,3 @@ 'use strict'

for (var i = 0; i < 2048; i++) {
for (let i = 0; i < 2048; i++) {
const id = instance()

@@ -32,3 +32,3 @@

for (var i = 0; i < 1000000; i++) {
for (let i = 0; i < 1000000; i++) {
const id = instance()

@@ -50,3 +50,3 @@

for (var i = 0; i < 1000000; i++) {
for (let i = 0; i < 1000000; i++) {
const id = instance()

@@ -53,0 +53,0 @@

@@ -17,8 +17,8 @@ 'use strict'

var conflicts = 0
var ids = 0
let conflicts = 0
let ids = 0
const max = maxInt * 2
for (var i = 0; i < max; i += Math.ceil(Math.random() * 4096)) {
for (let i = 0; i < max; i += Math.ceil(Math.random() * 4096)) {
const id = instance()

@@ -49,8 +49,8 @@

var conflicts = 0
var ids = 0
let conflicts = 0
let ids = 0
const max = maxInt * 2
for (var i = 0; i < max; i += Math.ceil(Math.random() * 4096)) {
for (let i = 0; i < max; i += Math.ceil(Math.random() * 4096)) {
const id = instance()

@@ -57,0 +57,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