Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
unlimited-curry
Advanced tools
npm install unlimited-curry --save
I wanted to have a small unlimited currying solution for functional programming techniques so that I can develop domain-specific languages easily and keep its application close to the code, Moreover, use it for different kind of tasks. I started educating myself to LISP and tying to transpiring back to my daily work life some practical concept, using data as code and creating small domain specific languages, this is an attempt for that.
I wrote cowlog and the central point of the application is the usage of its specific small DSL trough chained function calls. The code that creates this possibility was complex and precise, really too hard to understand, maintain develop and refactor; entirely the worst kind. The idea was if we extract this necessarily complex monster into and external reusable library.
I present the usage of the library with the example below; there are many ways to use it, let's start with the most practically applicable one.
In this example, you can see the library if you do callback needs to have two of them the first receives the error code that is 0 at the moment only, in the future it can change and the second that is all the parameters you chained trough. From this you cannot return anything, instead, do something with them. The second callback returns a value you calculate via a promise as you see. The empty closing parenthesis makes sure your first call is evaluated in a sync way. If you need a return value, you have to use your promise mojo to get it back.
const unlimitedCurry = require('unlimited-curry')
async function () {
const fn = unlimitedCurry(
(e, parameters) => {
//will not return anything, will be execited anyways
},
parameters=>`${parameters.data.returnArray[0]}${parameters.data.returnArray[1]}${parameters.data.returnArray[2]}`
)
const returnValue = await fn('a')('b')('c')()
console.log(returnValue)
expect(returnValue).to.be.equal('abc')
} ()
As you see this example looks just a bit different, but his small difference not calling the empty parenthesis makes the first callbacks execution async as well. Technically it is a setTimeout(()=>{}, 0) you can google it, that was enlightening for me, maybe you would enjoy that doing so. Later in this documentation, for now, please consult the source.
const unlimitedCurry = require('unlimited-curry')
const fn = unlimitedCurry(
(e, parameters) => {
//will not return anything, will be execited anyways
},
parameters=>parameters.data.returnArray[0]
+ parameters.data.returnArray[1]
+ parameters.data.returnArray[2]
)
const returnValue = await fn('a')('b')('c').p.then(data=>data)
console.log(returnValue)
expect(returnValue).to.be.equal('abc')
FAQs
Unlimited curry
The npm package unlimited-curry receives a total of 4 weekly downloads. As such, unlimited-curry popularity was classified as not popular.
We found that unlimited-curry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.