ChemPal Documentation - v1.6.0
    Preparing search index...

    Module helpers/schema-org

    Classes - Helpers

    SchemaOrgData

    Extracts, normalizes, and queries schema.org JSON-LD found on a page.

    Functions - Helpers

    stripSchemaEnumPrefix

    Strip a leading http(s)://schema.org/ from a schema.org enumeration value, leaving the bare member name (e.g. "https://schema.org/InStock" becomes "InStock"). Only a single identifier segment is stripped, so real URLs, the @context, @id links, and off-site URLs are returned unchanged.

    toArray

    Normalize a possibly-single, possibly-repeated property value to an array. schema.org allows any property to carry one value or many, so wrapping is the safe way to iterate (e.g. image may be a single URL or a list).

    typeList

    Read a node's @type as a string array. An item may declare several types at once (schema.org uses multiple inheritance — something can be both a Book and a Product), and @type may be absent, so this always returns an array.

    isSchemaContext

    Decide whether a JSON-LD @context denotes schema.org, tolerating every form seen in the wild: http/https, an optional trailing slash, an array of contexts, or an object whose values point at schema.org (e.g. an @vocab).

    Type Aliases - Helpers

    SchemaNode

    A single schema.org entity — a JsonObject that normally carries an @type (and, at the top level, an @context). Every Thing in schema.org is modelled this way.