@w11k/rx-ninja
    Preparing search index...

    Function isPathNotNil

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol

      Parameters

      Returns obj is PathNotNil_1<O, P1> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol

      Parameters

      Returns obj is PathNotNil_2<O, P1, P2> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol
      • P3 extends string | number | symbol

      Parameters

      Returns obj is PathNotNil_3<O, P1, P2, P3> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol
      • P3 extends string | number | symbol
      • P4 extends string | number | symbol

      Parameters

      Returns obj is PathNotNil_4<O, P1, P2, P3, P4> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol
      • P3 extends string | number | symbol
      • P4 extends string | number | symbol
      • P5 extends string | number | symbol

      Parameters

      Returns obj is PathNotNil_5<O, P1, P2, P3, P4, P5> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol

      Parameters

      Returns (obj: O) => obj is PathNotNil_1<O, P1> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol

      Parameters

      Returns (obj: O) => obj is PathNotNil_2<O, P1, P2> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol
      • P3 extends string | number | symbol

      Parameters

      Returns (obj: O) => obj is PathNotNil_3<O, P1, P2, P3> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol
      • P3 extends string | number | symbol
      • P4 extends string | number | symbol

      Parameters

      Returns (obj: O) => obj is PathNotNil_4<O, P1, P2, P3, P4> & O

    • Checks whether the given property path contains null or undefined within the given object. Narrows the type of each property in the path from T | null | undefined to T.

      There are two variants:

      A simple function for direct calls (e.g. in if-statement-conditions). It asks for the object to check as well as the property path.

      The second variant is a factory-function which only gets the property path. It returns a pre-configured predicate function for usage with functional calls like Array#filter.

      Both variants have overloads with up to 5 properties to check.

      Example:

      const x: { a: { b: number | undefined } } = { a: { b: 1 } };

      // simple usage: pass object and property path
      if (isPathNotNil(x, 'a', 'b')) {
      // type of x is now { a: { b: number } }
      x.a.b.toFixed(3); // safe to access a and b
      }

      // array usage: just pass the properties to check
      [x]
      .filter(isPathNotNil('a', 'b'))
      // type is now [{ a: { b: number } }]
      .map(x => x.a.b.toFixed(3)) // safe to access a and b

      With a path of just one property it does the same as isPropertyNotNil.

      Type Parameters

      • O extends object
      • P1 extends string | number | symbol
      • P2 extends string | number | symbol
      • P3 extends string | number | symbol
      • P4 extends string | number | symbol
      • P5 extends string | number | symbol

      Parameters

      Returns (obj: O) => obj is PathNotNil_5<O, P1, P2, P3, P4, P5> & O