Browse Source

Replace check-types depricated unemptyString with nonEmptyString

See https://www.npmjs.com/package/check-types#what-changed-from-4x-to-5x
pull/405/head
Julian Simioni 9 years ago
parent
commit
cb7b38bc75
  1. 2
      helper/labelGenerator.js
  2. 2
      sanitiser/_boundary_country.js
  3. 2
      sanitiser/_categories.js
  4. 4
      sanitiser/_ids.js
  5. 2
      sanitiser/_source.js
  6. 4
      sanitiser/_targets.js
  7. 2
      sanitiser/_text.js

2
helper/labelGenerator.js

@ -16,7 +16,7 @@ module.exports = function( record ){
var buildOutput = function(parts, schemaArr, record) {
for (var i=0; i<schemaArr.length; i++) {
var fieldValue = record[schemaArr[i]];
if (check.unemptyString(fieldValue) && !_.includes(parts, fieldValue)) {
if (check.nonEmptyString(fieldValue) && !_.includes(parts, fieldValue)) {
parts.push( fieldValue );
return parts;
}

2
sanitiser/_boundary_country.js

@ -13,7 +13,7 @@ function sanitize(raw, clean) {
if (check.assigned(country)){
// must be valid string
if (!check.unemptyString(country)) {
if (!check.nonEmptyString(country)) {
messages.errors.push('boundary.country is not a string');
}

2
sanitiser/_categories.js

@ -11,7 +11,7 @@ function sanitize( raw, clean ){
clean.categories = [];
// if categories string has been set
if( check.unemptyString( raw.categories ) ){
if( check.nonEmptyString( raw.categories ) ){
// map input categories to valid format
clean.categories = raw.categories.split(',')

4
sanitiser/_ids.js

@ -63,7 +63,7 @@ function sanitize( raw, clean ){
// error & warning messages
var messages = { errors: [], warnings: [] };
if (!check.unemptyString( raw.ids )) {
if (!check.nonEmptyString( raw.ids )) {
messages.errors.push( lengthError);
return messages;
}
@ -75,7 +75,7 @@ function sanitize( raw, clean ){
rawIds = _.unique(rawIds);
// ensure all elements are valid non-empty strings
if (!rawIds.every(check.unemptyString)) {
if (!rawIds.every(check.nonEmptyString)) {
messages.errors.push( lengthError );
}

2
sanitiser/_source.js

@ -16,7 +16,7 @@ function sanitize( raw, clean ) {
// default case (no layers specified in GET params)
// don't even set the from_layers key in this case
if( check.unemptyString( raw.source ) ){
if( check.nonEmptyString( raw.source ) ){
var sources = raw.source.split(',');

4
sanitiser/_targets.js

@ -24,11 +24,11 @@ function sanitize( raw, clean, opts ) {
var targetsString = raw[opts.paramName];
// trim whitespace
if( check.unemptyString( targetsString ) ){
if( check.nonEmptyString( targetsString ) ){
targetsString = targetsString.trim();
// param must be a valid non-empty string
if( !check.unemptyString( targetsString ) ){
if( !check.nonEmptyString( targetsString ) ){
messages.errors.push(
opts.paramName + ' parameter cannot be an empty string. Valid options: ' + opts.targetMapKeysString
);

2
sanitiser/_text.js

@ -8,7 +8,7 @@ function sanitize( raw, clean ){
var messages = { errors: [], warnings: [] };
// invalid input 'text'
if( !check.unemptyString( raw.text ) ){
if( !check.nonEmptyString( raw.text ) ){
messages.errors.push('invalid param \'text\': text length, must be >0');
}

Loading…
Cancel
Save