Options
All
  • Public
  • Public/Protected
  • All
Menu

Module conformsTo

Index

References

Functions Lang

References

Renames and re-exports conformsTo

Lang Functions

  • conformsTo<T>(object: T, source: { [ key in string | number | symbol]?: (value: any) => boolean }): boolean
  • Checks if object conforms to source by invoking the predicate properties of source with the corresponding property values of object.

    Note: This method is equivalent to conforms when source is partially applied.

    since

    5.12.0

    example
    const object = { 'a': 1, 'b': 2 }

    conformsTo(object, { 'b': function(n) { return n > 1 } })
    // => true

    conformsTo(object, { 'b': function(n) { return n > 2 } })
    // => false

    Type parameters

    • T: Record<string, any>

    Parameters

    • object: T

      The object to inspect.

    • source: { [ key in string | number | symbol]?: (value: any) => boolean }

      The object of property predicates to conform to.

    Returns boolean

    Returns true if object conforms, else false.