ronantakizawa/codereview-bench huggingface dataset:
Repository: toss/es-toolkit
File: src/array/flatMap.ts (TypeScript)

Code before:
/**
 * Maps each element in the array using the iteratee function and flattens the result up to the specified depth.
 *
 * @template T - The type of elements within the array.
 * @template U - The type of elements within the returned array from the iteratee function.
 * @template D - The depth to which the array should be flattened.
 * @param {T[]} arr - The array to flatten.
 * @param {(item: T) => U} iteratee - The function that produces the new array elements.
 * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.
 * @returns {Array<FlatArray<U[], D>>} The new array with the mapped and flattened elements.
 *
 * @example
 * const arr = [1, 2, 3];
 *
 * flatMap(arr, (item: number) => [item, item]);
 * // [1, 1, 2, 2, 3, 3]
 *
 * flatMap(arr, (item: number) => [[item, item]], 2);
 * // [1, 1, 2, 2, 3, 3]
 */
export function flatMap<T, U, D extends number>(
  arr: readonly T[],
  iteratee: (item: T) => U,
  depth = 1 as D
): Array<FlatArray<U[], D>> {
  return flatten(arr.map(iteratee), depth);
}


Review comment (suggestion):
```suggestion
  return flatten(arr.map(item => iteratee(item)), depth);
```

We prefer inline lambda functions because we might accidentally pass `index` as the second argument to `iteratee`.

Code after:
/**
 * Maps each element in the array using the iteratee function and flattens the result up to the specified depth.
 *
 * @template T - The type of elements within the array.
 * @template U - The type of elements within the returned array from the iteratee function.
 * @template D - The depth to which the array should be flattened.
 * @param {T[]} arr - The array to flatten.
 * @param {(item: T) => U} iteratee - The function that produces the new array elements.
 * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.
 * @returns {Array<FlatArray<U[], D>>} The new array with the mapped and flattened elements.
 *
 * @example
 * const arr = [1, 2, 3];
 *
 * flatMap(arr, (item: number) => [item, item]);
 * // [1, 1, 2, 2, 3, 3]
 *
 * flatMap(arr, (item: number) => [[item, item]], 2);
 * // [1, 1, 2, 2, 3, 3]
 */
export function flatMap<T, U, D extends number>(
  arr: readonly T[],
  iteratee: (item: T) => U,
  depth = 1 as D
): Array<FlatArray<U[], D>> {
  return flatten(arr.map(item => iteratee(item)), depth);
}
Repository: toss/es-toolkit
File: src/promise/withTimeout.spec.ts (TypeScript)

Code before:
import { describe, expect, it } from 'vitest';
import { withTimeout } from './withTimeout.ts';
import { delay } from './delay.ts';

describe('withTimeout', () => {
  it('returns the result value if a response is received before the specified wait time', () => {
    const result = await withTimeout(async () => {
      await delay(50);
      return 'foo';
    }, 100);

    expect(result).toEqual('foo');
  });

  it('returns a reason if a response is received after the specified wait time', () => {
    expect(withTimeout(() => delay(100), 50)).rejects.toThrow('The operation was timed out');
  });
});


Review comment (suggestion):
```suggestion
  it('returns the result value if a response is received before the specified wait time', async () => {
```

Code after:
import { describe, expect, it } from 'vitest';
import { withTimeout } from './withTimeout.ts';
import { delay } from './delay.ts';

describe('withTimeout', () => {
  it('returns the result value if a response is received before the specified wait time', async () => {
    const result = await withTimeout(async () => {
      await delay(50);
      return 'foo';
    }, 100);

    expect(result).toEqual('foo');
  });

  it('returns a reason if a response is received after the specified wait time', () => {
    expect(withTimeout(() => delay(100), 50)).rejects.toThrow('The operation was timed out');
  });
});
Repository: toss/es-toolkit
File: src/object/invert.ts (TypeScript)

Code before:
/**
 * Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.
 *
 * This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values,
 * the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping
 * of the input object's key-value pairs.
 *
 * @template K - Type of the keys in the input object (string, number, symbol)
 * @template V - Type of the values in the input object (string, number, symbol)
 * @param {Record<K, V>} obj - The input object whose keys and values are to be inverted
 * @returns {{ [key in V]: K }} - A new object with keys and values inverted
 *
 * @example
 * invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' }
 * invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' }
 * invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }
 * invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }
 */
export function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {
  const result = {} as { [key in V]: K };

  const keys = Object.keys(obj) as K[];
  for (let i = 0; i < keys.length; i++) {
    const key = keys[i];
    const value = obj[key];
    result[value] = key;
  }

  return result;
}


Review comment (suggestion):
```suggestion
  const keys = Object.keys(obj) as K[];
  
  for (let i = 0; i < keys.length; i++) {
    const key = keys[i];
    const value = obj[key];
```

Code after:
/**
 * Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.
 *
 * This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values,
 * the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping
 * of the input object's key-value pairs.
 *
 * @template K - Type of the keys in the input object (string, number, symbol)
 * @template V - Type of the values in the input object (string, number, symbol)
 * @param {Record<K, V>} obj - The input object whose keys and values are to be inverted
 * @returns {{ [key in V]: K }} - A new object with keys and values inverted
 *
 * @example
 * invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' }
 * invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' }
 * invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }
 * invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }
 */
export function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {
  const result = {} as { [key in V]: K };

  const keys = Object.keys(obj) as K[];
  
  for (let i = 0; i < keys.length; i++) {
    const key = keys[i];
    const value = obj[key];
    result[value] = key;
  }

  return result;
}
Repository: toss/es-toolkit
File: src/compat/array/head.spec.ts (TypeScript)

Code before:
import { describe, expect, it } from 'vitest';
import { head, first } from '../index';

const arrayProto = Array.prototype;

/**
 * @see https://github.com/lodash/lodash/blob/6a2cc1dfcf7634fea70d1bc5bd22db453df67b42/test/head.spec.js#L1
 */
describe('head', () => {
  const array = [1, 2, 3, 4];

  it('should return the first element', () => {
    expect(head(array)).toBe(1);
  });

  // it('should return `undefined` when querying empty arrays', () => {
  //   arrayProto[0] = 1;
  //   expect(head([])).toBe(undefined);
  //   arrayProto.length = 0;
  // });

  it('should work as an iteratee for methods like `map`', () => {
    const array = [
      [1, 2, 3],
      [4, 5, 6],
      [7, 8, 9],
    ];
    const actual = array.map(head);

    expect(actual).toEqual([1, 4, 7]);
  });

  it('should be aliased', () => {
    expect(first).toBe(head);
  });
});


Review comment (suggestion):
It seems that lodash returns undefined even if the first element of the Array prototype is overwritten so I'm not sure if es-toolkit's `head` should support that or have a different compat version of it?

###### Lodash's implementation
```js
function head(array) {
    return array != null && array.length ? array[0] : undefined;
}
```

Code after:
import { describe, expect, it } from 'vitest';
import { head, first } from '../index';

/**
 * @see https://github.com/lodash/lodash/blob/6a2cc1dfcf7634fea70d1bc5bd22db453df67b42/test/head.spec.js#L1
 */
describe('head', () => {
  const array = [1, 2, 3, 4];

  it('should return the first element', () => {
    expect(head(array)).toBe(1);
  });

  it('should work as an iteratee for methods like `map`', () => {
    const array = [
      [1, 2, 3],
      [4, 5, 6],
      [7, 8, 9],
    ];
    const actual = array.map(head);

    expect(actual).toEqual([1, 4, 7]);
  });

  it('should be aliased', () => {
    expect(first).toBe(head);
  });
});
Repository: toss/es-toolkit
File: src/object/clone.ts (TypeScript)

Code before:
  if (obj instanceof Date) {
    return new Date(obj.getTime()) as T;
  }

  if (obj instanceof RegExp) {
    return new RegExp(obj.source, obj.flags) as T;
  }

  if (obj instanceof Map) {
    const result = new Map();
    for (const [key, value] of obj) {
      result.set(key, value);
    }
    return result as T;
  }

  if (obj instanceof Set) {
    const result = new Set();
    for (const value of obj) {
      result.add(value);
    }
    return result as T;
  }

  if (typeof obj === 'object') {
    return Object.assign(Object.create(Object.getPrototypeOf(obj)), obj);
  }
  return obj;
}

type Primitive = null | undefined | string | number | boolean | symbol | bigint;

function isPrimitive(value: unknown): value is Primitive {
  return value == null || (typeof value !== 'object' && typeof value !== 'function');
}


Review comment (suggestion):
```suggestion
    const prototype = Object.getPrototypeOf(obj);
    const result = Object.create(prototype)
    return Object.assign(result, obj);
```

Code after:
  if (obj instanceof Date) {
    return new Date(obj.getTime()) as T;
  }

  if (obj instanceof RegExp) {
    return new RegExp(obj.source, obj.flags) as T;
  }

  if (obj instanceof Map) {
    const result = new Map();
    for (const [key, value] of obj) {
      result.set(key, value);
    }
    return result as T;
  }

  if (obj instanceof Set) {
    const result = new Set();
    for (const value of obj) {
      result.add(value);
    }
    return result as T;
  }

  if (typeof obj === 'object') {
    const prototype = Object.getPrototypeOf(obj);
    const result = Object.create(prototype)
    return Object.assign(result, obj);
  }
  return obj;
}

type Primitive = null | undefined | string | number | boolean | symbol | bigint;

function isPrimitive(value: unknown): value is Primitive {
  return value == null || (typeof value !== 'object' && typeof value !== 'function');
}
Repository: toss/es-toolkit
File: src/function/after.spec.ts (TypeScript)

Code before:
describe('after', () => {
  it('should throw error if n is less than zero.', async () => {
    const mockFn = vi.fn();
    const n = -1;
    expect(() => after(n, mockFn)).toThrowErrorMatchingInlineSnapshot('[Error: n must be a non-negative integer.]');
    expect(() => after(NaN, mockFn)).toThrowErrorMatchingInlineSnapshot('[Error: n must be a non-negative integer.]');
  });

  it('should create a function that invokes `func` only after being called `n` calls.`', async () => {
    const mockFn = vi.fn();
    const n = 3;

    const afterFn = after(n, mockFn);
    for (let i = 0; i < n - 1; i++) {
      expect(afterFn()).toBeUndefined();
    }
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(2);
  });

  it('shoud not invoke func immediately when n is zero.', async () => {
    const mockFn = vi.fn();
    const afterFn = after(0, mockFn);
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);
  });

  it('shoud handle arguments correctly.', async () => {
    const mockFn = vi.fn();
    mockFn.mockReturnValue(3);

    const afterFn = after(0, mockFn);
    expect(afterFn(1, 2)).toBe(3);
    expect(mockFn).toHaveBeenCalledWith(1, 2);
    expect(mockFn).toHaveBeenCalledTimes(1);
  });
});


Review comment (suggestion):
```suggestion
  it('should not invoke func immediately when n is zero.', async () => {
```

Code after:
describe('after', () => {
  it('should throw error if n is less than zero.', async () => {
    const mockFn = vi.fn();
    const n = -1;
    expect(() => after(n, mockFn)).toThrowErrorMatchingInlineSnapshot('[Error: n must be a non-negative integer.]');
    expect(() => after(NaN, mockFn)).toThrowErrorMatchingInlineSnapshot('[Error: n must be a non-negative integer.]');
  });

  it('should create a function that invokes `func` only after being called `n` calls.`', async () => {
    const mockFn = vi.fn();
    const n = 3;

    const afterFn = after(n, mockFn);
    for (let i = 0; i < n - 1; i++) {
      expect(afterFn()).toBeUndefined();
    }
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(2);
  });

  it('should not invoke func immediately when n is zero.', async () => {
    const mockFn = vi.fn();
    const afterFn = after(0, mockFn);
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);
  });

  it('should handle arguments correctly.', async () => {
    const mockFn = vi.fn();
    mockFn.mockReturnValue(3);

    const afterFn = after(0, mockFn);
    expect(afterFn(1, 2)).toBe(3);
    expect(mockFn).toHaveBeenCalledWith(1, 2);
    expect(mockFn).toHaveBeenCalledTimes(1);
  });
});
Repository: toss/es-toolkit
File: src/function/after.spec.ts (TypeScript)

Code before:
    const mockFn = vi.fn();
    const n = 3;

    const afterFn = after(n, mockFn);
    for (let i = 0; i < n - 1; i++) {
      expect(afterFn()).toBeUndefined();
    }
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(2);
  });

  it('shoud not invoke func immediately when n is zero.', async () => {
    const mockFn = vi.fn();
    const afterFn = after(0, mockFn);
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);
  });

  it('shoud handle arguments correctly.', async () => {
    const mockFn = vi.fn();
    mockFn.mockReturnValue(3);

    const afterFn = after(0, mockFn);
    expect(afterFn(1, 2)).toBe(3);
    expect(mockFn).toHaveBeenCalledWith(1, 2);
    expect(mockFn).toHaveBeenCalledTimes(1);
  });
});


Review comment (suggestion):
```suggestion
  it('should handle arguments correctly.', async () => {
```

Code after:
    const mockFn = vi.fn();
    const n = 3;

    const afterFn = after(n, mockFn);
    for (let i = 0; i < n - 1; i++) {
      expect(afterFn()).toBeUndefined();
    }
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(2);
  });

  it('should not invoke func immediately when n is zero.', async () => {
    const mockFn = vi.fn();
    const afterFn = after(0, mockFn);
    expect(mockFn).toHaveBeenCalledTimes(0);

    afterFn();
    expect(mockFn).toHaveBeenCalledTimes(1);
  });

  it('should handle arguments correctly.', async () => {
    const mockFn = vi.fn();
    mockFn.mockReturnValue(3);

    const afterFn = after(0, mockFn);
    expect(afterFn(1, 2)).toBe(3);
    expect(mockFn).toHaveBeenCalledWith(1, 2);
    expect(mockFn).toHaveBeenCalledTimes(1);
  });
});
Repository: toss/es-toolkit
File: src/compat/predicate/isNull.spec.ts (TypeScript)

Code before:
import { describe, expect, it } from 'vitest';
import { isNull } from '../../predicate';
import { falsey } from '../_internal/falsey';

/**
 * @see https://github.com/lodash/lodash/blob/main/test/isNull.spec.js
 */
describe('isNull', () => {
  it('should return `true` for `null` values', () => {
    expect(isNull(null)).toBe(true);
  });

  it('should return `false` for non `null` values', () => {
    const expected = falsey.map(value => value === null);
    const actual = falsey.map((value, index) => (index ? isNull(value) : isNull(undefined)));

    (function () {
      expect(isNull(arguments)).toBe(false);
    })(1, 2, 3);
    expect(actual).toEqual(expected);
    expect(isNull([1, 2, 3])).toBe(false);
    expect(isNull(true)).toBe(false);
    expect(isNull(new Date())).toBe(false);
    expect(isNull(new Error())).toBe(false);
    expect(isNull(Array.prototype.slice)).toBe(false);
    expect(isNull({ a: 1 })).toBe(false);
    expect(isNull(1)).toBe(false);
    expect(isNull(/x/)).toBe(false);
    expect(isNull('a')).toBe(false);
    expect(isNull(Symbol('a'))).toBe(false);
    expect(isNull(undefined)).toBe(false);
  });
});


Review comment (suggestion):
```suggestion
    // eslint-disable-next-line
    (function (..._args: any[]) {
```

Code after:
import { describe, expect, it } from 'vitest';
import { isNull } from '../../predicate';
import { falsey } from '../_internal/falsey';

/**
 * @see https://github.com/lodash/lodash/blob/main/test/isNull.spec.js
 */
describe('isNull', () => {
  it('should return `true` for `null` values', () => {
    expect(isNull(null)).toBe(true);
  });

  it('should return `false` for non `null` values', () => {
    const expected = falsey.map(value => value === null);
    const actual = falsey.map((value, index) => (index ? isNull(value) : isNull(undefined)));

    // eslint-disable-next-line
    (function (..._args: any[]) {
      // eslint-disable-next-line
      expect(isNull(arguments)).toBe(false);
    })(1, 2, 3);
    expect(actual).toEqual(expected);
    expect(isNull([1, 2, 3])).toBe(false);
    expect(isNull(true)).toBe(false);
    expect(isNull(new Date())).toBe(false);
    expect(isNull(new Error())).toBe(false);
    expect(isNull(Array.prototype.slice)).toBe(false);
    expect(isNull({ a: 1 })).toBe(false);
    expect(isNull(1)).toBe(false);
    expect(isNull(/x/)).toBe(false);
    expect(isNull('a')).toBe(false);
    expect(isNull(Symbol('a'))).toBe(false);
    expect(isNull(undefined)).toBe(false);
  });
});
Repository: toss/es-toolkit
File: src/compat/predicate/isNull.spec.ts (TypeScript)

Code before:
import { describe, expect, it } from 'vitest';
import { isNull } from '../../predicate';
import { falsey } from '../_internal/falsey';

/**
 * @see https://github.com/lodash/lodash/blob/main/test/isNull.spec.js
 */
describe('isNull', () => {
  it('should return `true` for `null` values', () => {
    expect(isNull(null)).toBe(true);
  });

  it('should return `false` for non `null` values', () => {
    const expected = falsey.map(value => value === null);
    const actual = falsey.map((value, index) => (index ? isNull(value) : isNull(undefined)));

    // eslint-disable-next-line
    (function (..._args: any[]) {
      expect(isNull(arguments)).toBe(false);
    })(1, 2, 3);
    expect(actual).toEqual(expected);
    expect(isNull([1, 2, 3])).toBe(false);
    expect(isNull(true)).toBe(false);
    expect(isNull(new Date())).toBe(false);
    expect(isNull(new Error())).toBe(false);
    expect(isNull(Array.prototype.slice)).toBe(false);
    expect(isNull({ a: 1 })).toBe(false);
    expect(isNull(1)).toBe(false);
    expect(isNull(/x/)).toBe(false);
    expect(isNull('a')).toBe(false);
    expect(isNull(Symbol('a'))).toBe(false);
    expect(isNull(undefined)).toBe(false);
  });
});


Review comment (suggestion):
```suggestion
      // eslint-disable-next-line
      expect(isNull(arguments)).toBe(false);
```

Code after:
import { describe, expect, it } from 'vitest';
import { isNull } from '../../predicate';
import { falsey } from '../_internal/falsey';

/**
 * @see https://github.com/lodash/lodash/blob/main/test/isNull.spec.js
 */
describe('isNull', () => {
  it('should return `true` for `null` values', () => {
    expect(isNull(null)).toBe(true);
  });

  it('should return `false` for non `null` values', () => {
    const expected = falsey.map(value => value === null);
    const actual = falsey.map((value, index) => (index ? isNull(value) : isNull(undefined)));

    // eslint-disable-next-line
    (function (..._args: any[]) {
      // eslint-disable-next-line
      expect(isNull(arguments)).toBe(false);
    })(1, 2, 3);
    expect(actual).toEqual(expected);
    expect(isNull([1, 2, 3])).toBe(false);
    expect(isNull(true)).toBe(false);
    expect(isNull(new Date())).toBe(false);
    expect(isNull(new Error())).toBe(false);
    expect(isNull(Array.prototype.slice)).toBe(false);
    expect(isNull({ a: 1 })).toBe(false);
    expect(isNull(1)).toBe(false);
    expect(isNull(/x/)).toBe(false);
    expect(isNull('a')).toBe(false);
    expect(isNull(Symbol('a'))).toBe(false);
    expect(isNull(undefined)).toBe(false);
  });
});
Repository: toss/es-toolkit
File: src/compat/predicate/isUndefined.spec.ts (TypeScript)

Code before:
import { describe, expect, it } from 'vitest';
import { isUndefined } from '../../predicate';
import { falsey } from '../_internal/falsey';

describe('isUndefined', () => {
  it('should return `true` for `undefined` values', () => {
    expect(isUndefined(undefined)).toBe(true);
  });

  it('should return `false` for non `undefined` values', () => {
    const expected = falsey.map(value => value === undefined);
    const actual = falsey.map((value, index) => (index ? isUndefined(value) : isUndefined(undefined)));
    expect(actual).toEqual(expected);

    (function () {
      expect(isUndefined(arguments)).toBe(false);
    })(1, 2, 3);
    expect(isUndefined([1, 2, 3])).toBe(false);
    expect(isUndefined(true)).toBe(false);
    expect(isUndefined(new Date())).toBe(false);
    expect(isUndefined(new Error())).toBe(false);
    expect(isUndefined(Array.prototype.slice)).toBe(false);
    expect(isUndefined({ a: 1 })).toBe(false);
    expect(isUndefined(1)).toBe(false);
    expect(isUndefined(/x/)).toBe(false);
    expect(isUndefined('a')).toBe(false);
    expect(isUndefined(Symbol('a'))).toBe(false);
  });
});


Review comment (suggestion):
```suggestion
      // eslint-disable-next-line prefer-rest-params
      expect(isUndefined(arguments)).toBe(false);
```

Code after:
import { describe, expect, it } from 'vitest';
import { isUndefined } from '../../predicate';
import { falsey } from '../_internal/falsey';

describe('isUndefined', () => {
  it('should return `true` for `undefined` values', () => {
    expect(isUndefined(undefined)).toBe(true);
  });

  it('should return `false` for non `undefined` values', () => {
    const expected = falsey.map(value => value === undefined);
    const actual = falsey.map((value, index) => (index ? isUndefined(value) : isUndefined(undefined)));
    expect(actual).toEqual(expected);

    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    (function (..._: any[]) {
      // eslint-disable-next-line prefer-rest-params
      expect(isUndefined(arguments)).toBe(false);
    })(1, 2, 3);
    expect(isUndefined([1, 2, 3])).toBe(false);
    expect(isUndefined(true)).toBe(false);
    expect(isUndefined(new Date())).toBe(false);
    expect(isUndefined(new Error())).toBe(false);
    expect(isUndefined(Array.prototype.slice)).toBe(false);
    expect(isUndefined({ a: 1 })).toBe(false);
    expect(isUndefined(1)).toBe(false);
    expect(isUndefined(/x/)).toBe(false);
    expect(isUndefined('a')).toBe(false);
    expect(isUndefined(Symbol('a'))).toBe(false);
  });
});