Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
hkt-toolbelt
Advanced tools
Functional and composable type utilities
hkt-toolbelt
is a collection of type-level utilities that can be mapped and combined in functional ways using higher-kinded types.
Our composable and compile time-efficient types enable users to write expressive and readable type-level code without getting mired in complexity.
> npm install hkt-toolbelt
> yarn add hkt-toolbelt
import {
$, $$, $N,
Boolean, Conditional, Function,
List, Object, String, Union,
Number, Integer, NaturalNumber,
Kind, Type, Combinator, Parser,
} from "hkt-toolbelt";
$
: Apply a Function to an Argument
$<KIND, ARG>
import { $, List, Conditional } from "hkt-toolbelt";
type HelloWorld = $<$<List.Push, "world">, ["hello"]>; // ["hello", "world"]
type OneTwoThree = $<
$<List.Filter, $<Conditional.Extends, number>>,
[1, "foo", 2, 3, "bar"]
>; // [1, 2, 3]
$N
: Pass Multiple Arguments into an uncurried Function
$N<KIND, [ARG1, ARG2, ...]>
import { $, $N, List, NaturalNumber } from "hkt-toolbelt";
// Example 1: full application (invoked with all three arguments)
type ReduceSum1to5 = $N<List.Reduce, [
NaturalNumber.Add, // callback
0, // initial value
[1, 2, 3, 4, 5] // target array
]>; // 15
// Example 2: partial application (invoked with only the first two arguments)
type ReduceSum = $N<List.Reduce, [NaturalNumber.Add, 0]>;
type ReduceSum1to5 = $<ReduceSum, [1, 2, 3, 4, 5]>; // 15
type ReduceSum1to10 = $<ReduceSum, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>; // 55
$$
: Pipe an Argument through Multiple Functions
$$<[KIND1, KIND2, ...], ARG>
import { $, $$, List, String } from "hkt-toolbelt";
type UnshiftPushJoin = $$<[
$<List.Unshift, "first">, // ["first", "second"]
$<List.Push, "third">, // ["first", "second", "third"]
$<String.Join, ", ">, // "first, second, third"
], ["second"]>;
FAQs
Functional and composable type utilities
The npm package hkt-toolbelt receives a total of 960 weekly downloads. As such, hkt-toolbelt popularity was classified as not popular.
We found that hkt-toolbelt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.