Skip to main content

General

80
  • &

    takes a regex op re, and predicates. Returns a regex-op that consumes input as per re but subjects the resulting value t...

  • *

    Returns a regex op that matches zero or more values matching pred. Produces a vector of matches iff there is at least on...

  • *compile-asserts*

    If true, compiler will enable spec asserts, which are then subject to runtime control via check-asserts? If false, compi...

  • +

    Returns a regex op that matches one or more values matching pred. Produces a vector of matches

  • ?

    Returns a regex op that matches zero or one value matching pred. Produces a single value (not a collection) if matched.

  • alt

    Takes key+pred pairs, e.g. (s/alt :even even? :small #(< % 42)) Returns a regex op that returns a map entry containing...

  • ancestors

    Returns the immediate and indirect parents of tag, either via a JavaScript type inheritance relationship or a relationsh...

  • and

    Takes predicate/spec-forms, e.g. (s/and even? #(< % 42)) Returns a spec that returns the conformed value. Successive c...

  • assert

    spec-checking assert expression. Returns x if x is valid? according to spec, else throws an error with explain-data plus...

  • assert*

    Do not call this directly, use 'assert'.

  • cat

    Takes key+pred pairs, e.g. (s/cat :e even? :o odd?) Returns a regex op that matches (all) values in sequence, returnin...

  • check-asserts

    Enable or disable spec asserts that have been compiled with '*compile-asserts*' true. See 'assert'. Initially set to bo...

  • check-asserts?

    Returns the value set by check-asserts.

  • coll-of

    Returns a spec for a collection of items satisfying pred. Unlike generator will fill an empty init-coll. Same options a...

  • conform

    Given a spec and a value, returns :cljs.spec.alpha/invalid if value does not match spec, else the (possibly destructured...

  • conformer

    takes a predicate function with the semantics of conform i.e. it should return either a (possibly converted) value or :c...

  • def

    Given a namespace-qualified keyword or resolveable symbol k, and a spec, spec-name, predicate or regex-op makes an entry...

  • defmethod

    Creates and installs a new method of multimethod associated with dispatch-value.

  • defmulti

    Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options ...

  • defprotocol

    A protocol is a named set of named methods and their signatures: (defprotocol AProtocolName ;optional doc string "A...

  • derive

    Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword a...

  • descendants

    Returns the immediate and indirect children of tag, through a relationship established via derive. h must be a hierarchy...

  • describe

    returns an abbreviated description of the spec as data

  • double-in

    Specs a 64-bit floating point number. Options: :infinite? - whether +/- infinity allowed (default true) :NaN? - ...

  • every

    takes a pred and validates collection elements against that pred. Note that 'every' does not do exhaustive checking, ra...

  • every-kv

    like 'every' but takes separate key and val preds and works on associative collections. Same options as 'every', :into ...

  • exercise

    generates a number (default 10) of values compatible with spec and maps conform over them, returning a sequence of [val ...

  • exercise-fn

    exercises the fn named by sym (a symbol) by applying it to n (default 10) generated samples of its args spec. When fspec...

  • explain

    Given a spec and a value that fails to conform, prints an explanation to *out*.

  • explain-data

    Given a spec and a value x which ought to conform, returns nil if x conforms, else a map with at least the key ::problem...

  • explain-out

    Prints explanation data (per 'explain-data') to *out* using the printer in *explain-out*, by default explain-printer.

  • explain-printer

    Default printer for explain-data. nil indicates a successful validation.

  • explain-str

    Given a spec and a value that fails to conform, returns an explanation as a string.

  • extend-protocol

    Useful when you want to provide several implementations of the same protocol all at once. Takes a single protocol and th...

  • extend-type

    Extend a type to a series of protocols. Useful when you are supplying the definitions explicitly inline. Propagates the ...

  • fdef

    Takes a symbol naming a function, and one or more of the following: :args A regex spec for the function arguments as th...

  • form

    returns the spec as data

  • fspec

    takes :args :ret and (optional) :fn kwargs whose values are preds and returns a spec whose conform/explain take a fn and...

  • gen

    Given a spec, returns the generator for it, or throws if none can be constructed. Optionally an overrides map can be pro...

  • get-method

    Given a multimethod and a dispatch value, returns the dispatch fn that would apply to that value, or nil if none apply a...

  • get-spec

    Returns spec registered for keyword/symbol/var k, or nil.

  • inst-in

    Returns a spec that validates insts in the range from start (inclusive) to end (exclusive).

  • inst-in-range?

    Return true if inst at or after start and before end

  • int-in

    Returns a spec that validates fixed precision integers in the range from start (inclusive) to end (exclusive).

  • int-in-range?

    Return true if start <= val, val < end and val is a fixed precision integer.

  • invalid?

    tests the validity of a conform return value

  • keys

    Creates and returns a map validating spec. :req and :opt are both vectors of namespaced-qualified keywords. The validato...

  • keys*

    takes the same arguments as spec/keys and returns a regex op that matches sequences of key/values, converts them into a ...

  • make-hierarchy

    Creates a hierarchy object for use with derive, isa? etc.

  • map-of

    Returns a spec for a map whose keys satisfy kpred and vals satisfy vpred. Unlike 'every-kv', map-of will exhaustively co...

  • merge

    Takes map-validating specs (e.g. 'keys' specs) and returns a spec that returns a conformed map satisfying all of the spe...

  • methods

    Given a multimethod, returns a map of dispatch values -> dispatch fns

  • multi-spec

    Takes the name of a spec/predicate-returning multimethod and a tag-restoring keyword or fn (retag). Returns a spec that...

  • nilable

    returns a spec that accepts nil and values satisfiying pred

  • nonconforming

    takes a spec and returns a spec that has the same properties except 'conform' returns the original (not the conformed) v...

  • or

    Takes key+pred pairs, e.g. (s/or :even even? :small #(< % 42)) Returns a destructuring spec that returns a map entry c...

  • parents

    Returns the immediate parents of tag, either via a JavaScript type inheritance relationship or a relationship establishe...

  • prefer-method

    Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y when there is a conflict

  • regex?

    returns x if x is a (cljs.spec.alpha) regex op, else logical false

  • registry

    returns the registry map, prefer 'get-spec' to lookup a spec by name

  • spec

    Takes a single predicate form, e.g. can be the name of a predicate, like even?, or a fn literal like #(< % 42). Note tha...

  • spec?

    returns x if x is a spec object, else logical false

  • tuple

    takes one or more preds and returns a spec for a tuple, a vector where each element conforms to the corresponding pred. ...

  • underive

    Removes a parent/child relationship between parent and tag. h must be a hierarchy obtained from make-hierarchy, if not s...

  • unform

    Given a spec and a value created by or compliant with a call to 'conform' with the same spec, returns a value with all c...

  • valid?

    Helper function that returns true when x is valid for spec.

  • with-gen

    Takes a spec and a no-arg, generator-returning fn and returns a version of that spec that uses that generator