Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
trampoline-js
Advanced tools
Transforms recursion ⟹ loop
Install from npm
npm install trampoline-js
let { trampoline, done, more } = require('trampoline-js')
const times = (() => {
// optional accumulators & user input
const _times = (acc, n, s) =>
n <= 0
// on done (base condition)
? done(acc)
// continuation as thunks
// takes continuation function and params
: more(_times, `${acc}${s}`, n - 1, s)
// build trampoline by passing recursive function and optional initial objects
return trampoline(_times, '')
})()
times(5, '*')
// > '*****'
function trampoline(genFun, [args])
trampoline
takes generate/recursive function and optional arguments (optional). it returns a function of formfunction ([arguments]) {}
.
On invoking returned function,
genFun
will be called withargs
followed by caller suppliedarguments
.
genFun
should return eitherdone
(a wrapper for base case) ormore
(a wrapper function for continuation function). Otherwise, 'Invalid continuation' Error will be thrown.
function more(fun, [args])
more
should provide continuation function as first parameter and optional args.
function cont(fun, [args])
Alias for
more
.
function done(result)
done
is a base case wrapper which takes terminal object andresult
will be returned as output.
This plugin is licensed under the MIT license.
Copyright (c) 2016 Prince John Wesley
FAQs
Transforms recursion ⟹ loop
The npm package trampoline-js receives a total of 3 weekly downloads. As such, trampoline-js popularity was classified as not popular.
We found that trampoline-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.