🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

dat-encoding

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dat-encoding - npm Package Compare versions

Comparing version

to
4.0.2

6

index.js

@@ -7,4 +7,5 @@ 'use strict'

if (typeof buf === 'string') return encode(decode(buf))
if (!Buffer.isBuffer(buf)) throw new Error('Not a buffer')
if (buf.length !== 32) throw new Error('Invalid buffer')
return Buffer.from(buf).toString('hex')
return buf.toString('hex')
}

@@ -14,3 +15,4 @@

if (Buffer.isBuffer(str)) return decode(encode(str))
var match = /(?:[a-z]+:\/\/(?:dat\.land\/)?)?([^/]{64})/.exec(str)
if (typeof str !== 'string') throw new Error('Not a string')
var match = /\/?([^/]{64})/.exec(str)
if (!match) throw new Error('Invalid key')

@@ -17,0 +19,0 @@ return Buffer.from(match[1], 'hex')

{
"name": "dat-encoding",
"version": "4.0.1",
"version": "4.0.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": "juliangruber/dat-encoding",

@@ -11,2 +11,3 @@ var test = require('tape')

{type: 'valid', key: 'dat.land/6161616161616161616161616161616161616161616161616161616161616161/'},
{type: 'valid', key: 'host.com/whatever/6161616161616161616161616161616161616161616161616161616161616161'},
{type: 'invalid', key: new Buffer('key-me-maybe', 'hex')},

@@ -13,0 +14,0 @@ {type: 'invalid', key: 'key-me-maybe'},