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.
checker-factory
Advanced tools
Checker Factory used by Deku Prop Type Validators
npm install --save checker-factory
import checkerFactory from 'checker-factory'
const numberChecker = checkerFactory('number', 'number')
numberChecker.validate('hello', 'age')
// => TypeError: Expected age to be of type `number`, but got `string`
numberChecker.validate(3, 'age')
// => undefined
const requiredString = checkerFactory('string', 'string').isRequired
requiredString.validate(undefined, 'name')
// => Error: name is required
const evenNumberChecker = checkerFactory('evenNumber', (prop, key) => {
if (prop % 2 === 1) {
return new Error(`Expected ${key} to be an even number`)
}
})
evenNumberChecker.validate(3, 'id')
// => Error: Expected id to be an even number
Returns a CheckerFactory with an isRequired
getter and validate
function.
type: string
The name of the CheckerFactory. This name is how users will reference the checker. For example, a name of string will have users using propTypes.string.
type: function
| string
If validator
is a string
, then a typeof
check will be performed. If validator
is a function
, then the function will be execution. The function is passed the prop
value and the key
name.
MIT © Dustin Specker
FAQs
Checker Factory used by Deku Prop Type Validators
The npm package checker-factory receives a total of 1 weekly downloads. As such, checker-factory popularity was classified as not popular.
We found that checker-factory 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.