New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cfvdb/core

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cfvdb/core - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

test/resources/with-starter-short-compressed.txt

8

lib/deck-list-generator.js

@@ -0,1 +1,2 @@

const LZUTF8 = require('lzutf8');
const {sumCountsOfCards} = require('./utils');

@@ -10,3 +11,4 @@

printSectionHeaders: true,
printCardNames: true
printCardNames: true,
compress: false
}

@@ -56,2 +58,6 @@

if (options.compress) {
text = LZUTF8.compress(text, {outputEncoding: 'Base64'});
}
return text;

@@ -58,0 +64,0 @@ }

@@ -0,1 +1,2 @@

const LZUTF8 = require('lzutf8');
const { getCardDataOfMultipleCards } = require('./card-fetcher');

@@ -27,2 +28,4 @@ const { getCardType } = require('./utils');

str = decompressIfNeeded(str);
const allCards = [];

@@ -89,2 +92,10 @@

function decompressIfNeeded(str) {
if (!str.includes('\n')) {
str = LZUTF8.decompress(str, {inputEncoding: 'Base64'});
}
return str;
}
module.exports = parseDeckList;

5

package.json
{
"name": "@cfvdb/core",
"version": "0.0.16",
"version": "0.0.17",
"description": "Core functions for CFVDB",

@@ -16,3 +16,4 @@ "main": "index.js",

"dependencies": {
"axios": "^0.21.1"
"axios": "^0.21.1",
"lzutf8": "^0.6.0"
},

@@ -19,0 +20,0 @@ "devDependencies": {

@@ -30,2 +30,13 @@ const DeckListGenerator = require('../lib/deck-list-generator');

});
it('compress', async () => {
const inputDeckStr = await fs.readFile(path.join(__dirname, 'resources/with-starter-short.txt'), 'utf-8');
const expectedResult = await fs.readFile(path.join(__dirname, 'resources/with-starter-short-compressed.txt'), 'utf-8');
const deck = await parse(inputDeckStr, {url: SEARCH_API_URL});
const generator = new DeckListGenerator();
const result = generator.generate(deck, {printSectionHeaders: false, printPostamble: false, printPreamble: false, printCardNames: false, compress: true});
assert.deepStrictEqual(result, expectedResult);
});
});

@@ -79,2 +79,12 @@ const parseDeckList = require('../lib/deck-list-parser');

});
it('compressed deck list', async () => {
const compressedDeckList = await fs.readFile(path.join(__dirname, 'resources/with-starter-short-compressed.txt'), 'utf-8');
const result = await parseDeckList(compressedDeckList, {url: SEARCH_API_URL});
assert.deepStrictEqual(result.normal.cards.length, 10);
assert.deepStrictEqual(result.trigger.cards.length, 5);
assert.deepStrictEqual(result.token.cards.length, 2);
assert.deepStrictEqual(result.order.cards.length, 2);
});
});
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