
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@foko/type-check
Advanced tools
Assert-style non-intrusive type checks.
It works similar to assert() where you simply state what should happen and then continue
to operate. If the type check fails, a valid TypeError is thrown and your function will halt.
Simple example:
function add (a, b) {
typeCheck('number', a)
typeCheck('number', b)
return a + b
}
add(1, 1) // returns 2
add('1', 1) // throws TypeError
add('1') // throws TypeError
add(1) // throws TypeError
// etc.
Type detection is handled by type-detect by the lovely team over at
chaijs. If you would like to use your own type detection, you can swap it out by replacing the function
at typeCheck.typeOf:
const typeCheck = require('@karimsa/type-check')
// this replaces the type-detect typeOf function with just a native
// use of typeof (which is faster but less useful)
typeCheck.typeOf = function (value) {
return typeof value
}
If you would like to make types optional (i.e. the type, undefined, or null) - just append ? to the end
of the type name.
Example with optional types:
// all valid
typeCheck('number?', 2)
typeCheck('number?', undefined)
typeCheck('number?', null)
// invalid
typeCheck('number?', '2')
Licensed under MIT license.
Copyright © 2018-present Foko Inc. All rights reserved.
FAQs
Assert-style non-intrusive type checking.
The npm package @foko/type-check receives a total of 1 weekly downloads. As such, @foko/type-check popularity was classified as not popular.
We found that @foko/type-check 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 researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.