export {};

declare global {
  interface Array<T> {
    lengthChecked(): number;
    hasItems(): boolean;
  }

  interface Boolean {
    ifTrue(callback): boolean;
    ifFalse(callback): boolean;
  }
}

Array.prototype.lengthChecked = function () {
  return this && this[0] ? this.length : 0;
};

Array.prototype.hasItems = function () {
  return this && this.length > 0;
};

Boolean.prototype.ifTrue = function (callback) {
  if (this && this.valueOf() === true) {
    callback();
    return false;
  }
};

Boolean.prototype.ifFalse = function (callback) {
  if (this && this.valueOf() === false) {
    callback();
    return true;
  }
};
