Socket
Socket
Sign inDemoInstall

aproba

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

9

index.js

@@ -40,4 +40,9 @@ 'use strict'

function invalidType (num, type, value) {
return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' + type + ' but got ' + typeof value)
function invalidType (num, expectedType, value) {
var valueType
Object.keys(types).forEach(function (typeCode) {
if (types[typeCode][1](value)) valueType = types[typeCode][0]
})
return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
expectedType + ' but got ' + valueType)
}

@@ -44,0 +49,0 @@

{
"name": "aproba",
"version": "1.0.2",
"version": "1.0.3",
"description": "A rediculously light-weight argument validator",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,3 +26,3 @@ 'use strict'

test('general', function (t) {
t.plan(69)
t.plan(70)
var values = {

@@ -82,2 +82,8 @@ 'A': [],

})
try {
validate('O', [[]])
t.fail('object != array')
} catch (ex) {
t.match(ex.message, /Expected object but got array/, 'When reporting non-objects, uses aproba types')
}
})
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc