def

func:fits

fits(val, spec, opts: null)

Return if the given instance fits the spec via structural typing. Use specFits() to check structural typing between two types. Also see is() and specIs() to check via nominal typing. Use fitsExplain() to explain why fits returns true or false.

If the val is a Dict, then the default behavior is to only check the dict's tags against the given spec. In this mode all spec query slots are ignored. Pass the {graph} option to also check queries to validate the graph of entities. For example, the graph option can be used with equip specs to validate required points.

Options:

  • graph: marker to also check graph of references such as required points
  • ignoreRefs: marker to not validate if refs exist or match target spec

Examples:

fits("foo", Str)               >>  true
fits(123, Str)                 >>  false
fits({equip}, Equip)           >>  true
fits({equip}, Site)            >>  false
fits(vav, MyVavSpec)           >> validate tags only
fits(vav, MyVavSpec, {graph})  >> validate tags and required points

meta

supertypes

feature

Feature namespace of definitions formatted as feature:name

    func

Axon function