docs: async function filter(array, fn, self = undefined) {
    const v = await Promise.resolve(array);
    if (!Array.isArray(v)) {
      throw TypeError('not an array');
    }
  
    const arr = /** @type {!Array} */(v);
    const n = arr.length;
    const values = [];
    let valuesLength = 0;
  
    for (let i = 0; i < n; i++) {
      if (i in arr) {
        let value = arr[i];
        let include = await fn.call(self, value, i, arr);
        if (include) {
          values[valuesLength++] = value;
        }
      }
    }
    return values;
  }