
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
[](https://www.npmjs.com/package/funland) [](https://gitter.im/funfix/funfix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Funland is a specification of common algebraic structures for JavaScript, TypeScript and Flow, based on Fantasy Land and compatible with static-land.
For the TypeScript / Flow types, which are very light (no accompanying JavaScript code, just types):
npm install --save funland
For the laws:
npm install --save funland-laws
Usage of laws mostly makes sense in tests, being built for property-based testing, so usage of jsverify is recommended, but not required.
API docs:
Exposed type classes:
Setoid
(api / laws / static-land)Functor
(api / laws / static-land)Apply
(api / laws / static-land)Applicative
(api / laws / static-land)Chain
(api / laws / static-land)ChainRec
(api / laws / static-land)Monad
(api / laws / static-land)The included laws are meant for usage with property-based testing, so you'll need something like jsverify as a dependency.
npm install funland-laws --save-dev
npm install jsverify --save-dev
# For jsverify types (for TypeScript):
npm install @types/jsverify --save-dev
And then you can do something like this:
import * as jv from "jsverify"
import { Setoid } from "funland"
import { Equiv, SetoidLaws } from "funland-laws"
export function setoidCheck<A>(
genA: jv.Arbitrary<A>,
F: Setoid<A>,
lawsRef?: SetoidLaws<A>) {
const laws = lawsRef || new SetoidLaws<A>(F)
const eq = (p: Equiv<boolean>) => p.lh === p.rh
jv.property("setoid.reflexivity", genA,
x => eq(laws.reflexivity(x)))
jv.property("setoid.symmetry", genA, genA,
(x, y) => eq(laws.symmetry(x, y)))
jv.property("setoid.transitivity", genA, genA, genA,
(x, y, z) => eq(laws.transitivity(x, y, z)))
}
Such integration is currently not provided by Funland, however the project's repository has code to use for inspiration, see github.com/.../funland-laws/test-common.
The library has been compiled using UMD (Universal Module Definition), so it should work with CommonJS and AMD, for standalone usage in browsers or Node.js.
But it also provides a module
definition in package.json
, thus
providing compatibility with
ECMAScript 2015 modules,
for usage when used with a modern JS engine, or when bundling with a
tool chain that understands ES2015 modules,
like Rollup
or Webpack.
Funland exposes both TypeScript and Flow type annotations out of the box.
All code in this repository is licensed under the MIT license.
FAQs
[](https://www.npmjs.com/package/funland) [](https://gitter.im/funfix/funfix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
The npm package funland receives a total of 6,803 weekly downloads. As such, funland popularity was classified as popular.
We found that funland 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.