Socket
Socket
Sign inDemoInstall

coap-packet

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

21

index.js

@@ -238,9 +238,18 @@

function toCode(code) {
var split = code.split('.')
, byte = 0
byte |= parseInt(split[0]) << 5
byte |= parseInt(split[1])
var split = code.split && code.split('.')
, by = 0
return byte
if (split && split.length === 2) {
by |= parseInt(split[0]) << 5
by |= parseInt(split[1])
} else {
if (!split)
code = parseInt(code)
by |= (code / 100) << 5
by |= (code % 100)
}
return by
}

@@ -247,0 +256,0 @@

{
"name": "coap-packet",
"version": "0.1.3",
"version": "0.1.4",
"description": "Generate and Parse CoAP packets",

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

@@ -100,2 +100,5 @@ CoAP-Packet

Numerical codes can also be specified in HTTP format, like `500` or
`'404'`.
<a name="contributing"></a>

@@ -102,0 +105,0 @@ ## Contributing

@@ -981,2 +981,10 @@

})
it('should send and parse a code sent in HTTP-format', function() {
expect(parse(generate({ code: '500' }))).to.have.property('code', '5.00')
})
it('should send and parse a code sent in numeric HTTP-format', function() {
expect(parse(generate({ code: 500 }))).to.have.property('code', '5.00')
})
})
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