
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@justinc/sequence
Advanced tools
sequence This package exports a function similar to Ramda's sequence function.
Note that it is strictly curried (see demo usage below).
For this package to work, the Applicative (see below) ADT value you use must have the following sematics for the .ap method: fnApplicative.ap(valueApplicative). This is Fantasy Land pre-v1.0.0 semantics.
Folktale 2's Applicative ADTs have this behaviour for their .ap method (and support v1.0.0+ semantics of .ap via valueApplicative['fantasy-land/ap'](fnApplicative)).
sequence uses the .ap method. This means sequence will work with Folktale 2 ADTs (as well as Folktale 1 mico-libs like data.maybe etc…).
In the future, it is likely that a major version update of this package will take a config Object as the first curried function which can configure which sematics of .ap to use. Apart from this, it will be possible to add to this config enabling/disabling of "basic type checking" to make sure we have the required methods that make up an "Applicative". This "basic type checking" is on by force in version ^1.0.0 - which could get expensive for large iterables.
npm i @justinc/sequence
(See tests for more example usage). Also, there's a REPL file you can run with node repl.js.
const Maybe = require('folktale/data/maybe')
const sequence = require('@justinc/sequence')
const { Just, Nothing } = Maybe
// "strictly curried" means you cannot use short-hands like `sequence(Maybe.of, [Just(1), Just(2), Just(3)])`.
// That's extra functionality provided by Ramda (not provided here).
sequence(Maybe.of)([Just(1), Just(2), Just(3)]) // ==> Just([1, 2, 3])
Applicative.<Array.<T>>This function is curried.
The applicativeReturningFn is expected to return a value of type Applicative.
Also, it is expected that the Applicative returned by applicativeReturningFn
is of the same kind as the Applicatives in the given iterable (2nd curried param).
e.g. if applicativeReturningFn returns a Maybe, iterable is expected to have Maybe
values.
Just like the Ramda function with the same name, this function:
"Transforms a Traversable of Applicative into an Applicative of Traversable."
e.g. if applicativeReturningFn returns a Maybe, and iterable is made up of Maybe
T values, then this function returns a Maybe<Array<T>> where T is a type like String etc…
ObjectThis is a value as specified in the Fantasy Land spec for Applicative.
This means that a value of this type needs to have of, ap and map methods with the properties specified in the
Fantasy Land spec.
Applicative.<Array.<T>>This function is curried.
The applicativeReturningFn is expected to return a value of type Applicative.
Also, it is expected that the Applicative returned by applicativeReturningFn
is of the same kind as the Applicatives in the given iterable (2nd curried param).
e.g. if applicativeReturningFn returns a Maybe, iterable is expected to have Maybe
values.
Just like the Ramda function with the same name, this function:
"Transforms a Traversable of Applicative into an Applicative of Traversable."
e.g. if applicativeReturningFn returns a Maybe, and iterable is made up of Maybe
T values, then this function returns a Maybe<Array<T>> where T is a type like String etc…
Kind: global function
See: Applicative
| Param | Type | Description |
|---|---|---|
| [applicativeReturningFn] | function | A function that returns an Applicative |
| [iterable] | Iterable.<Applicative> | An iterable of Applicatives |
ObjectThis is a value as specified in the Fantasy Land spec for Applicative.
This means that a value of this type needs to have of, ap and map methods with the properties specified in the
Fantasy Land spec.
Kind: global typedef
FAQs
Similar to Ramda's sequence (as a micro lib)
We found that @justinc/sequence 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.