Shape descriptor is a format to describe data. This format optimizes for fast detection of value present given a shape and a value path.
This namespace contains functions to operate on maps in the shape descriptor format.
Shape descriptor is a format to describe data. This format optimizes for fast detection of value present given a shape and a value path. This namespace contains functions to operate on maps in the shape descriptor format.
(ast->shape-descriptor ast)
Convert EQL AST to shape descriptor format.
Convert EQL AST to shape descriptor format.
(data->shape-descriptor data)
Helper function to transform a map into an shape descriptor.
Edges of shape descriptor are always an empty map. If a value of the map is a sequence. This will combine the keys present in all items on the final shape description.
WARN: this idea of merging is still under test, this may change in the future.
Helper function to transform a map into an shape descriptor. Edges of shape descriptor are always an empty map. If a value of the map is a sequence. This will combine the keys present in all items on the final shape description. WARN: this idea of merging is still under test, this may change in the future.
(data->shape-descriptor-shallow data)
Like data->shape-descriptor, but only at the root keys of the data.
Like data->shape-descriptor, but only at the root keys of the data.
(difference s1 s2)
Like set/difference, for shapes.
Like set/difference, for shapes.
(intersection s1 s2)
Like set/intersection, for shapes.
Like set/intersection, for shapes.
(lift-placeholders-first-level env shape)
This function will normalize up all placeholders that start from the root of the tree.
For example:
{:>/foo {:a {}}} = becomes => {:a {}}
Nested items also are bring up:
{:>/foo {:a {} :>/other {:b {}}}} => {:a {} :b {}}
But placeholders not connected to the root as kept as-is:
{:coll {:>/inner {:a {}}}} => {:coll {:>/inner {:a {}}}}
This function will normalize up all placeholders that start from the root of the tree. For example: {:>/foo {:a {}}} = becomes => {:a {}} Nested items also are bring up: {:>/foo {:a {} :>/other {:b {}}}} => {:a {} :b {}} But placeholders not connected to the root as kept as-is: {:coll {:>/inner {:a {}}}} => {:coll {:>/inner {:a {}}}}
(merge-shapes a)
(merge-shapes a b)
Deep merge of shapes, it takes in account that values are always maps.
Deep merge of shapes, it takes in account that values are always maps.
(missing available-shape required-shape)
(missing available required data)
Given some available and required shapes, returns which items are missing from available in the required. Returns nil when nothing is missing.
Given some available and required shapes, returns which items are missing from available in the required. Returns nil when nothing is missing.
(missing-from-data available-data required-shape)
Like missing, but starts from data instead of shape. If you are starting from data prefer this over missing, this can perform better by avoiding scanning the whole available data to build a shape, when the required-shape is a sub-set of the available data.
Like missing, but starts from data instead of shape. If you are starting from data prefer this over missing, this can perform better by avoiding scanning the whole available data to build a shape, when the required-shape is a sub-set of the available data.
(query->shape-descriptor output)
Convert pathom output format into shape descriptor format.
Convert pathom output format into shape descriptor format.
(relax-empty-collections required data)
This helper will remove nested requirements when data is an empty collection. This allows for nested inputs with empty collections to still be valid in shape.
This helper will remove nested requirements when data is an empty collection. This allows for nested inputs with empty collections to still be valid in shape.
(select-shape data shape)
Select the parts of data covered by shape. This is similar to select-keys, but for nested shapes.
Select the parts of data covered by shape. This is similar to select-keys, but for nested shapes.
(select-shape-filtering data shape)
(select-shape-filtering data shape required-shape)
Like select-shape, but in case of collections, if some item doesn't have all the required keys, it's removed from the collection.
Like select-shape, but in case of collections, if some item doesn't have all the required keys, it's removed from the collection.
(shape-descriptor->ast shape)
Convert pathom output format into shape descriptor format.
Convert pathom output format into shape descriptor format.
(shape-descriptor->ast-children shape)
Convert pathom output format into shape descriptor format.
Convert pathom output format into shape descriptor format.
(shape-descriptor->query shape)
Convert shape descriptor format to EQL.
Convert shape descriptor format to EQL.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close