Browse Source

only true or 1 is valid

pull/103/head
Harish Krishna 10 years ago
parent
commit
c78c8e2dbe
  1. 2
      helper/geojsonify.js
  2. 4
      test/unit/helper/geojsonify.js

2
helper/geojsonify.js

@ -12,7 +12,7 @@ function search( docs, details ){
return false; // remove offending doc from results return false; // remove offending doc from results
} }
details = details || false; details = details === true || details === 1;
// flatten & expand data for geojson conversion // flatten & expand data for geojson conversion
var geodata = docs.map( function( doc ){ var geodata = docs.map( function( doc ){

4
test/unit/helper/geojsonify.js

@ -178,7 +178,7 @@ module.exports.tests.search = function(test, common) {
] ]
}; };
var truthy_params = [true, 1, -1, 123, 'abc']; var truthy_params = [true, 1];
test('geojsonify.search(doc, true) with details', function(t) { test('geojsonify.search(doc, true) with details', function(t) {
var json = geojsonify.search( input, true ); var json = geojsonify.search( input, true );
@ -252,7 +252,7 @@ module.exports.tests.search = function(test, common) {
t.end(); t.end();
}); });
var falsy_params = [false, undefined, null, 0 ]; var falsy_params = [false, undefined, null, 0, -1, 123, 'abc'];
falsy_params.forEach(function(details) { falsy_params.forEach(function(details) {
test('geojsonify.search(doc, '+ details +') with no details', function(t) { test('geojsonify.search(doc, '+ details +') with no details', function(t) {

Loading…
Cancel
Save