From f6f45916c8d3280e1a7dc297e70a2f8371ae4e9c Mon Sep 17 00:00:00 2001 From: Daniele Dellafiore <66707+ildella@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:49:28 +0200 Subject: [PATCH] depends on just-curry-it. Let's be honest, one must curry sometimes. And so /core do not depend on /fusto anymore --- core/fs-utils.js | 2 +- lnd/lnd-polar-config.js | 4 ++++ package.json | 7 ++++++- tests/core/fs-utils.test.js | 12 ++++++++++++ yarn.lock | 5 +++++ 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 tests/core/fs-utils.test.js diff --git a/core/fs-utils.js b/core/fs-utils.js index 6e05f81..dc99b70 100644 --- a/core/fs-utils.js +++ b/core/fs-utils.js @@ -1,6 +1,6 @@ const {EOL} = require('os') const {readFile, writeFile, mkdir} = require('fs/promises') -const {curry} = require('../fusto') +const curry = require('just-curry-it') /* eslint-disable security/detect-non-literal-fs-filename diff --git a/lnd/lnd-polar-config.js b/lnd/lnd-polar-config.js index 08e46b4..7519e4c 100644 --- a/lnd/lnd-polar-config.js +++ b/lnd/lnd-polar-config.js @@ -5,6 +5,10 @@ const {curry} = require('../fusto') const polarBasePath = networkNumber => `${homedir()}/.polar/networks/${networkNumber}/volumes/lnd/` +/* + eslint-disable security/detect-non-literal-fs-filename +*/ + module.exports = curry((polarNetwork, { host = 'localhost', port = '8081', diff --git a/package.json b/package.json index f177e8c..f6576e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moar-js", - "version": "0.4.3", + "version": "0.5.1", "description": "Simple JavaScript files I use across projects", "license": "MIT", "author": { @@ -10,6 +10,8 @@ "JavaScript", "Library", "Streams", + "Functional", + "Curry", "Bitcoin Ligthing Network", "LND", "HTTP", @@ -54,5 +56,8 @@ "pino-pretty": "10.2.0", "tracer": "1.1.6", "ws": "8.13.0" + }, + "dependencies": { + "just-curry-it": "5.3.0" } } diff --git a/tests/core/fs-utils.test.js b/tests/core/fs-utils.test.js new file mode 100644 index 0000000..53743a4 --- /dev/null +++ b/tests/core/fs-utils.test.js @@ -0,0 +1,12 @@ +const fs = require('fs/promises') + +const {fs: {writeText, readText}} = require('../../core') + +afterEach(() => fs.unlink('.test-text')) + +test('write text', async () => { + const write = writeText('.test-text') + const result = await write('hello') + expect(result).toEqual('hello') + expect(await readText('.test-text')).toEqual('hello\n') +}) diff --git a/yarn.lock b/yarn.lock index 9763268..7cd95f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2754,6 +2754,11 @@ json5@^2.1.3, json5@^2.2.2: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== +just-curry-it@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/just-curry-it/-/just-curry-it-5.3.0.tgz#1463602e932c5beb431a2a384dddcd48bb3c9c42" + integrity sha512-silMIRiFjUWlfaDhkgSzpuAyQ6EX/o09Eu8ZBfmFwQMbax7+LQzeIU2CBrICT6Ne4l86ITCGvUCBpCubWYy0Yw== + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"