
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Fast strong typed 'Either' data structure for typescript and flow
$ npm install --save apropos
//@flow
import defaultOf, {
of,
ofL,
Right,
Left,
is,
makeError,
type Apropos,
type MakeError,
} from 'apropos'
function of<R>(value: R): Apropos<void, R>
Create pure right-handed value, left-handed type is empty. Exports by default
function ofL<L>(value: L): Apropos<L, void>
Create pure left-handed value, right-handed type is empty.
function Right<-L, R>(value: R): Apropos<L, R>
Create right-handed value, left-handed type is inferred from usage.
Technically, Right
returns the same as of
; the difference is only in the type inference.
function Left<L, -R>(value: L): Apropos<L, R>
Create left-handed value, right-handed type is inferred from usage
function is<-T>(value: T): boolean
Checks whether an object is an instance of Apropos
class AnnotatedError<Context, Tag> extends Error {
tag: Tag
data: Context
}
function makeError<-Tag>(tag: Tag): <Context>(data: Context) => AnnotatedError<Context, Tag>
Create fabric for generating tagged error constructors.
Useful in .mapL
.
See annotated errors
isRight
isLeft
equals
thru
orElse
swap
promise
fold
map
mapR
mapL
bimap
tap
tapR
tapL
bitap
chain
chainR
chainL
bichain
cond
chainCond
logic
alt
and
ap
import { of, makeError, MakeError, Left } from 'apropos'
const notNumber: MakeError<'Not a number'> = makeError('Not a number')
const isNegative: MakeError<'Negative number'> = makeError('Negative number')
const positiveNum =
of(-2)
.map(x => x + 1)
.chain(x => typeof x === 'number'
? of(x)
: Left(x))
.mapL(notNumber)
.logic({
cond: x => x > 0,
pass: x => 'Positive number: ' + x,
fail: isNegative
})
positiveNum.fold(x => console.log(x), x => console.error(x))
// => Annotated Error: 'Negative number' -1
The project is released under the Mit License
FAQs
Strong typed functional 'Either', 'Maybe', 'Identity' and 'Tuple'
The npm package apropos receives a total of 2 weekly downloads. As such, apropos popularity was classified as not popular.
We found that apropos 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.