compress-brotli
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="1.0.3"></a> | ||
## [1.0.3](https://github.com/Kikobeats/compress-brotli/compare/v1.0.2...v1.0.3) (2019-04-11) | ||
<a name="1.0.2"></a> | ||
@@ -7,0 +12,0 @@ ## [1.0.2](https://github.com/Kikobeats/compress-brotli/compare/v1.0.1...v1.0.2) (2019-04-06) |
@@ -15,3 +15,3 @@ 'use strict' | ||
enable = true, | ||
serialize = JSON.stringify, | ||
serialize = val => Buffer.from(JSON.stringify(val)), | ||
deserialize = JSON.parse | ||
@@ -29,3 +29,2 @@ } = {}) => { | ||
let serializedData = serialize(data) | ||
if (!hasNativeAPI) serializedData = Buffer.from(serializedData) | ||
return compress(serializedData) | ||
@@ -32,0 +31,0 @@ }, |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://nicedoc.io/Kikobeats/compress-brotli", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "index.js", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -5,2 +5,3 @@ 'use strict' | ||
const createCompress = require('..') | ||
const v8 = require('v8') | ||
@@ -21,1 +22,12 @@ ;[ | ||
}) | ||
test('custom serializer/deserializer', async t => { | ||
const { compress, decompress } = createCompress({ | ||
serialize: v8.serialize, | ||
deserialize: v8.deserialize | ||
}) | ||
const value = { foo: 'bar', fooz: { foo: 'bar' }, arr: [1, 2, 3, 4] } | ||
const compressedData = await compress(value) | ||
const decompressedData = await decompress(compressedData) | ||
t.deepEqual(decompressedData, value) | ||
}) |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
10621
57
1