Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typeforce

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeforce - npm Package Compare versions

Comparing version 1.15.1 to 1.16.0

async.js

15

index.js

@@ -233,17 +233,2 @@ var ERRORS = require('./errors')

// async wrapper
function __async (type, value, strict, callback) {
// default to falsy strict if using shorthand overload
if (typeof strict === 'function') return __async(type, value, false, strict)
try {
typeforce(type, value, strict)
} catch (e) {
return callback(e)
}
callback()
}
typeforce.async = __async
typeforce.compile = compile

@@ -250,0 +235,0 @@ typeforce.TfTypeError = TfTypeError

6

package.json
{
"name": "typeforce",
"version": "1.15.1",
"version": "1.16.0",
"description": "Another biased type checking solution for Javascript",

@@ -21,6 +21,8 @@ "keywords": [

"files": [
"async.js",
"errors.js",
"extra.js",
"index.js",
"native.js"
"native.js",
"nothrow.js"
],

@@ -27,0 +29,0 @@ "repository": {

@@ -117,2 +117,27 @@ # typeforce

**Pro**tips (no throw)
``` javascript
var typeforce = require('typeforce/nothrow')
var value = 'foobar'
if (typeforce(typeforce.Number, value)) {
// didn't throw!
console.log(`${value} is a number`) // never happens
} else {
console.log(`Oops, ${typeforce.error.message}`)
// prints 'Oops, Expected Number, got String foobar'
}
```
**Pro**tips (async)
```
var typeforce = require('typeforce/async')
typeforce(typeforce.Number, value, function (err) {
if (err) return console.log(`Oops, ${typeforce.error.message}`)
console.log(`${value} is a number`) // never happens
})
```
**WARNING**: Be very wary of using the `quacksLike` type, as it relies on the `Foo.name` property.

@@ -119,0 +144,0 @@ If that property is mangled by a transpiler, such as `uglifyjs`, you will have a bad time.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc