Browse Source

using is-object

pull/103/head
Harish Krishna 10 years ago
parent
commit
176f580215
  1. 4
      sanitiser/_details.js
  2. 4
      sanitiser/_geo.js
  3. 4
      sanitiser/_id.js
  4. 4
      sanitiser/_input.js
  5. 4
      sanitiser/_size.js

4
sanitiser/_details.js

@ -1,3 +1,5 @@
var isObject = require('is-object');
// validate inputs, convert types and apply defaults
function sanitize( req, default_value ){
@ -11,7 +13,7 @@ function sanitize( req, default_value ){
default_value = !!default_value;
// ensure the input params are a valid object
if( Object.prototype.toString.call( params ) !== '[object Object]' ){
if( !isObject( params ) ){
params = {};
}

4
sanitiser/_geo.js

@ -1,3 +1,5 @@
var isObject = require('is-object');
// validate inputs, convert types and apply defaults
function sanitize( req, latlon_is_required ){
@ -6,7 +8,7 @@ function sanitize( req, latlon_is_required ){
latlon_is_required = latlon_is_required || false;
// ensure the input params are a valid object
if( Object.prototype.toString.call( params ) !== '[object Object]' ){
if( !isObject( params ) ){
params = {};
}

4
sanitiser/_id.js

@ -1,3 +1,5 @@
var isObject = require('is-object');
// validate inputs, convert types and apply defaults
// id generally looks like 'geoname:4163334' (type:id)
// so, both type and id are required fields.
@ -10,7 +12,7 @@ function sanitize( req ){
var delim = ':';
// ensure params is a valid object
if( Object.prototype.toString.call( params ) !== '[object Object]' ){
if( !isObject( params ) ){
params = {};
}

4
sanitiser/_input.js

@ -1,3 +1,5 @@
var isObject = require('is-object');
// validate inputs, convert types and apply defaults
function sanitize( req ){
@ -6,7 +8,7 @@ function sanitize( req ){
var delim = ',';
// ensure the input params are a valid object
if( Object.prototype.toString.call( params ) !== '[object Object]' ){
if( !isObject( params ) ){
params = {};
}

4
sanitiser/_size.js

@ -1,3 +1,5 @@
var isObject = require('is-object');
// validate inputs, convert types and apply defaults
function sanitize( req, default_size){
@ -7,7 +9,7 @@ function sanitize( req, default_size){
default_size = default_size || 10;
// ensure the input params are a valid object
if( Object.prototype.toString.call( params ) !== '[object Object]' ){
if( !isObject( params ) ){
params = {};
}

Loading…
Cancel
Save