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

compact-encoding

Package Overview
Dependencies
Maintainers
0
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compact-encoding - npm Package Compare versions

Comparing version 2.15.1 to 2.16.0

16

index.js

@@ -495,2 +495,14 @@ const b4a = require('b4a')

exports.date = {
preencode (state, d) {
uint.preencode(state, d.getTime())
},
encode (state, d) {
uint.encode(state, d.getTime())
},
decode (state, d) {
return new Date(uint.decode(state))
}
}
exports.json = {

@@ -595,3 +607,4 @@ preencode (state, v) {

anyArray,
anyObject
anyObject,
exports.date
]

@@ -627,2 +640,3 @@

if (Array.isArray(o)) return 7
if (o instanceof Date) return 9
if (typeof o === 'object') return 8

@@ -629,0 +643,0 @@

2

package.json
{
"name": "compact-encoding",
"version": "2.15.1",
"version": "2.16.0",
"description": "A series of compact encoding schemes for building small and fast parsers and serializers",

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

@@ -146,2 +146,3 @@ # compact-encoding

* `cenc.fixed(n)` - Makes a fixed sized encoder.
* `cenc.date(d)` - Encodes a date object.
* `cenc.array(enc)` - Makes an array encoder from another encoder. Arrays are uint prefixed with their length.

@@ -148,0 +149,0 @@ * `cenc.raw.array(enc)` - Makes an array encoder from another encoder, without a length prefixed.

@@ -813,2 +813,8 @@ const enc = require('./')

test('date', function (t) {
const d = new Date()
t.alike(enc.decode(enc.date, enc.encode(enc.date, d)), d)
})
test('any', function (t) {

@@ -821,2 +827,3 @@ const o = {

nest: {},
today: new Date(),
float: 0.54

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