better validation of inputs

pull/1/head
ansuz 8 years ago
parent c7eae9675b
commit 402ce2db93

@ -38,8 +38,7 @@ define([
// you can ask the server to pin a particular channel for you // you can ask the server to pin a particular channel for you
exp.pin = function (channels, cb) { exp.pin = function (channels, cb) {
// TODO use isArray if it's safe if (!Array.isArray(channels)) {
if (!channels && channels.length) {
window.setTimeout(function () { window.setTimeout(function () {
cb('[TypeError] pin expects an array'); cb('[TypeError] pin expects an array');
}); });
@ -50,8 +49,7 @@ define([
// you can also ask to unpin a particular channel // you can also ask to unpin a particular channel
exp.unpin = function (channels, cb) { exp.unpin = function (channels, cb) {
// TODO use isArray if it's safe if (!Array.isArray(channels)) {
if (!channels && channels.length) {
window.setTimeout(function () { window.setTimeout(function () {
cb('[TypeError] pin expects an array'); cb('[TypeError] pin expects an array');
}); });
@ -72,8 +70,7 @@ define([
// if local and remote hashes don't match, send a reset // if local and remote hashes don't match, send a reset
exp.reset = function (channels, cb) { exp.reset = function (channels, cb) {
// TODO use isArray if it's safe if (!Array.isArray(channels)) {
if (!channels && channels.length) {
window.setTimeout(function () { window.setTimeout(function () {
cb('[TypeError] pin expects an array'); cb('[TypeError] pin expects an array');
}); });

Loading…
Cancel
Save