New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

input-filter

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

input-filter - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

src/filter/Bool.js

1

main.js

@@ -5,2 +5,3 @@ export default {

Bool: require('./src/filter/Bool.js'),
StringTrim: require('./src/filter/StringTrim.js'),

@@ -7,0 +8,0 @@ Float: require('./src/filter/Float.js'),

8

package.json
{
"name": "input-filter",
"version": "0.0.5",
"version": "0.0.6",
"description": "InputFilter js implementation",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha --compilers js:babel/register"
},

@@ -29,5 +29,9 @@ "repository": {

"babelify": "^6.0.2",
"chai": "^2.2.0",
"gulp": "^3.8.11",
"gulp-uglify": "^1.2.0"
},
"dependencies": {
"moment": "^2.10.2"
}
}

@@ -5,3 +5,7 @@

filter(value) {
return parseFloat(value)
let newValue = parseFloat(value)
if (isNaN(newValue)) {
throw new Error(`${value} is not a Number`)
}
return newValue
}

@@ -8,0 +12,0 @@ }

@@ -5,3 +5,7 @@

filter(value) {
return parseInt(value)
let newValue = parseInt(value)
if (isNaN(newValue)) {
throw new Error(`${value} is not a Number`)
}
return newValue
}

@@ -8,0 +12,0 @@ }

@@ -8,1 +8,3 @@

}
export default StringTrim

@@ -24,5 +24,2 @@ import FilterChain from './FilterChain.js'

setValue(value) {
if (value === this.value) {
return this
}
this.value = this.filterChain.filter(value)

@@ -29,0 +26,0 @@

@@ -8,5 +8,11 @@

this.valid = null
this.rawData = {}
this.data = {}
this.init()
}
init() {
}
add(input) {

@@ -19,3 +25,3 @@ this.inputs[input.name] = input

setData(data) {
this.data = data
this.rawData = data
this.reset()

@@ -26,3 +32,8 @@

getData() {
return this.data
}
reset() {
this.data = {}
this.promise = null

@@ -40,7 +51,7 @@ this.messages = {}

if (this.inputs.hasOwnProperty(name)) {
let value = this.data[name]
let input = this.inputs[name]
let promise = input.setValue(value).isValid(this.data)
promise.then(
() => {},
input.setValue(this.data[name])
this.data[name] = input.getValue()
let promise = input.isValid(this.data)
promise.catch(
(messages) => {

@@ -71,4 +82,8 @@ if (!this.messages[name]) {

}
getValue(key) {
return this.inputs[key].getValue()
}
}
export default InputFilter
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