Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Functional programming for Norwegians ⛷️
Not exactly. Well, not only for Norwegians. Inspired by Ramda, this an automatically curried, data-last, functional JavaScript library.
Declarative code
Much favored over "smart" code. As an example it is preferred to use existing higher-order functions like Array.prototype.every()
instead of reimplementing similar logic using loops.
Predictable behaviors
B.map(B.inc, 1)
should return 2
. Not []
, [undefined]
or [2]
. Just 2
.
ES6 compliant
It is totally fine to do B.map(B.inc, new Set([1, 2, 3]))
. This will simply return Set {2, 3, 4}
.
Feature-rich
As seen above, B.map
knows how to handle Sets
. Similarly, other B
functions that can operate on Arrays, typically knows how to operate on other data structures as well.
const incCollection = B.map(B.inc)
incCollection([1, 2, 3])
// => [2, 3, 4]
incCollection(new Set([1, 2, 3]))
// => Set {2, 3, 4}
const isFoo = B.equals('foo')
const allIsFoo = B.all(isFoo)
allIsFoo({x: 'foo', y: 'foo', z: 'foo'})
// => true
allIsFoo(['foo', 'bar', 'baz'])
// => false
const takeTwo = B.take(2)
takeTwo(new Map([[1, 'a'], [2, 'b'], [3, 'c']]))
// => Map { 1 => 'a', 2 => 'b' }
takeTwo('foobar')
// => 'fo'
const double = B.multiply(2)
const addFive = B.add(5)
const incDoubleAndAddFive = B.compose(addFive, double, B.inc)
incDoubleAndAddFive(1)
// => 9
const sqrtOfProduct = B.pipe(B.multiply, Math.sqrt)
sqrtOfProduct(3, 12)
// => 6
const multiplyThree = (a, b, c) => a * b * c
const multiplyThreeCurried = B.curry(multiplyThree)
multiplyThreeCurried(2)
// => Function
multiplyThreeCurried(2)(3)
multiplyThreeCurried(2, 3)
// => Function
multiplyThreeCurried(2)(3)(4)
multiplyThreeCurried(2, 3)(4)
multiplyThreeCurried(2)(3, 4)
// => 24
Install using yarn
:
yarn add bukk
Or npm
:
npm install --save bukk
Import module:
const B = require('bukk')
Or add the B
variable to global scope:
<script src="nodule_modules/bukk/dist/bukk.js"></script>
Install dependencies:
yarn install
Build:
yarn run build
Will lint the source code, run tests and generate code coverage, and build a minified version of the library.
Test once:
yarn run test
Test in watch mode:
yarn run watch:test
"Bukk" means "ram" in Norwegian :)
FAQs
Functional programming for Norwegians ⛷️
The npm package bukk receives a total of 17 weekly downloads. As such, bukk popularity was classified as not popular.
We found that bukk 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.