You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
390 B
18 lines
390 B
6 years ago
|
var typeforce = require('./')
|
||
|
|
||
|
// async wrapper
|
||
|
function tfAsync (type, value, strict, callback) {
|
||
|
// default to falsy strict if using shorthand overload
|
||
|
if (typeof strict === 'function') return tfAsync(type, value, false, strict)
|
||
|
|
||
|
try {
|
||
|
typeforce(type, value, strict)
|
||
|
} catch (e) {
|
||
|
return callback(e)
|
||
|
}
|
||
|
|
||
|
callback()
|
||
|
}
|
||
|
|
||
|
module.exports = Object.assign(tfAsync, typeforce)
|