Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
LIghtweight Functional programming library for TypeScript
yarn add lifts
# or
npm i -S lifts
Shorthand for Immediately Invoked Function Expression
const date = new Date('2020-04-17')
const result: number | null = Do(() => {
// check date is valid
if (!isNaN(date)) {
return date.getDate()
} else {
return null
}
})
result // => 17
// equivalent to
const result = (() => {
if (!isNaN(date)) {
return date.getDate()
} else {
return null
}
})()
Object-Style switch
const fn = (value: string) =>
Switch(value)(
{
a: () => 'String A',
b: () => 'String B',
},
() => null, // default value
)
fn('a') // => 'string A'
fn('b') // => 'string B'
fn('c') // => null (default value)
const parseDate = (dateStr: string): IResult<Date, Error> => {
const date = new Date(dateStr)
// check date is valid
if (!isNaN(date)) {
return Result.ok(date)
} else {
return Result.err(new Error('Invalid Date'))
}
}
parseDate('2020-04-17')
// => { isOk: true, valueOrError: Date('2020-04-17') }
parseDate('foo')
// => { isOk: false, valueOrError: Error('Invalid Date') }
const result = parseDate('2020-04-17')
Result.switch(result)({
ok: (value: Date) => {
// called if result is Ok
return value.getDate()
},
err: (error: Error) => {
// called if result is Err
return null
},
})
// => 17
const result = parseDate('foo')
Result.switch(result)({
ok: (value) => {
return value.getDate()
},
err: (error) => {
return null
},
})
// => null
Wraps Error with Result.err()
if error caught, else wraps value with Result.ok()
.
const result = Result.wrap(() => {
if (condition) {
return true
} else {
throw new Error()
}
})
FAQs
**LI**ghtweight **F**unctional programming library for **T**ype**S**cript
The npm package lifts receives a total of 65 weekly downloads. As such, lifts popularity was classified as not popular.
We found that lifts 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.