Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

to-unsigned-int32

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-unsigned-int32 - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

9

index.js

@@ -6,9 +6,10 @@ var dz = require('dezalgo')

if (n >= 0xff) {
return callback(new Error('Number can not represent in 32 bit'))
var buffr = new Buffer(4)
try {
buffr.writeUInt32BE(n, 0)
} catch(e) {
return callback(e)
}
var buffr = new Buffer(4)
buffr.writeUInt32BE(n, 0)
return callback(null, buffr)
}
{
"name": "to-unsigned-int32",
"version": "1.0.1",
"version": "1.1.0",
"description": "convert to number of 32 bit buffer",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,5 +5,5 @@ var tap = require('tap')

tap.test('should return error when number can not fit in 32 bit', function (t) {
toUInt32(0xfff, function (err, buff) {
toUInt32(0xaffffffff, function (err, buff) {
t.type(err, Error)
t.equal(err.message, 'Number can not represent in 32 bit', 'handling error for number can not fit in 32 bit')
t.equal(err.message, 'value is out of bounds', 'handling error for number can not fit in 32 bit')
t.notOk(buff, 'buff should be null')

@@ -10,0 +10,0 @@ t.end()

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