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

formconv

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formconv - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "formconv",
"version": "0.0.2",
"version": "0.0.3",
"description": "A utility function to convert and validate form post data, and filter secure data from data base object",

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

@@ -39,4 +39,4 @@ /**

var typeType = typeof type;
if(type != 'int' && type != String && type != Number && type != Date) {
throw new Error('wront type ' + type + ' for field ' + field);
if(type != 'int' && type != String && type != Number && type != Date && type != Array) {
throw new Error('wrong type ' + type + ' for field ' + field);
}

@@ -70,2 +70,5 @@ }

break;
case Array:
if(value instanceof Array) return value
return null
default:

@@ -72,0 +75,0 @@ throw new Error('not support type '+ fieldDefine.type)

@@ -12,3 +12,4 @@ var expect = require('expect.js')

reqString: {type: String, required: true},
reqNumber: {type: Number, required: true}
reqNumber: {type: Number, required: true},
array: Array
})

@@ -24,2 +25,3 @@

reqNumber: '50',
array: [],
nonExist: 'not exists'

@@ -35,2 +37,3 @@ }

expect(obj.reqDate).to.be.a(Date)
expect(obj.array).to.be.a(Array)
expect(obj.reqNumber).to.be.a('number')

@@ -47,2 +50,3 @@ })

reqNumber: 50,
array: [],
nonExist: 'not exists'

@@ -57,2 +61,3 @@ }

expect(obj.reqString).to.be.ok()
expect(obj.array).to.be.a(Array)
expect(obj.nonExist).to.be(undefined)

@@ -59,0 +64,0 @@ expect(obj.password).to.be(undefined)

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