Execute callback(s) for properties of the specified object.
function forMethods(obj, props, callback) {
    var prop;
    if (typeof props === "string") {
      // A single prop string was passed. Create an array.
      props = [props];
    } else if (props == null) {
      // No props were passed, so iterate over all properties, building an
      // array. Unfortunately, Object.keys(obj) doesn't work everywhere yet, so
      // this has to be done manually.
      props = [];
      for (prop in obj) {
        if (obj.hasOwnProperty(prop)) {
          props.push(prop);
        }
      }
    }
    // Execute callback for every method in the props array.
    var i = props.length;
    while (i--) {
      // If the property isn't a function...
      if (toString.call(obj[props[i]]) !== "[object Function]" ||
        // ...or the callback returns false...
        callback(obj, props[i]) === false) {
        // ...remove it from the props array to be returned.
        props.splice(i, 1);
      }
    }
    // Return an array of method names for which the callback didn't fail.
    return props;
  }