ts-data-forge
    Preparing search index...
    • Tests whether all elements in an array pass a test implemented by a predicate.

      Type Parameters

      • const Ar extends readonly unknown[] & {} & Readonly<
            {
                "TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3": unknown;
            },
        >
      • S extends unknown

      Parameters

      Returns array is ChangeArrayElement<Ar, S> & Ar

      const numbers = [2, 4, 6] as const;

      const words = ['Ada', 'Grace'] as const;

      const allEven = Arr.every(numbers, (value) => value % 2 === 0);

      const allStartWithA = Arr.every(words, (value) => value.startsWith('A'));

      assert.isTrue(allEven);

      assert.isFalse(allStartWithA);
    • Tests whether all elements in an array pass a test implemented by a predicate.

      Type Parameters

      • const Ar extends readonly unknown[]
      • S extends unknown

      Parameters

      Returns array is Readonly<{ [K in string | number | symbol]: S }> & Ar

      const numbers = [2, 4, 6] as const;

      const words = ['Ada', 'Grace'] as const;

      const allEven = Arr.every(numbers, (value) => value % 2 === 0);

      const allStartWithA = Arr.every(words, (value) => value.startsWith('A'));

      assert.isTrue(allEven);

      assert.isFalse(allStartWithA);
    • Tests whether all elements in an array pass a test implemented by a predicate.

      Type Parameters

      • const Ar extends readonly unknown[]

      Parameters

      Returns boolean

      const numbers = [2, 4, 6] as const;

      const words = ['Ada', 'Grace'] as const;

      const allEven = Arr.every(numbers, (value) => value % 2 === 0);

      const allStartWithA = Arr.every(words, (value) => value.startsWith('A'));

      assert.isTrue(allEven);

      assert.isFalse(allStartWithA);
    • Tests whether all elements in an array pass a test implemented by a predicate.

      Type Parameters

      • E
      • S

      Parameters

      • predicate: (a: E, index: Uint32) => a is S

      Returns <
          const Ar extends
              readonly E[] & {} & Readonly<
                  {
                      "TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3": unknown;
                  },
              >,
      >(
          array: Ar,
      ) => array is ChangeArrayElement<Ar, S> & Ar & <
          const Ar extends readonly E[],
      >(
          array: Ar,
      ) => array is Readonly<{ [K in string | number | symbol]: S }> & Ar

      const numbers = [2, 4, 6] as const;

      const words = ['Ada', 'Grace'] as const;

      const allEven = Arr.every(numbers, (value) => value % 2 === 0);

      const allStartWithA = Arr.every(words, (value) => value.startsWith('A'));

      assert.isTrue(allEven);

      assert.isFalse(allStartWithA);
    • Tests whether all elements in an array pass a test implemented by a predicate.

      Type Parameters

      • E

      Parameters

      • predicate: (a: E, index: Uint32) => boolean

      Returns (array: readonly E[]) => boolean

      const numbers = [2, 4, 6] as const;

      const words = ['Ada', 'Grace'] as const;

      const allEven = Arr.every(numbers, (value) => value % 2 === 0);

      const allStartWithA = Arr.every(words, (value) => value.startsWith('A'));

      assert.isTrue(allEven);

      assert.isFalse(allStartWithA);