Toba JSON-LD
TypeScript definitions and helper functions for JSON Link Data.
; ;
Helper Functions
The library can be used for only its type definitions (interfaces).
Format
Finalize Link Data document
Call ld
to finalize your Link Data document. This method replaces the more easily entered field names for id
, type
and context
with the @
-prefixed variants required by the JSON-LD standard.
;;
Convert document to text for web page inclusion
serializelinkData: any
Remove redundant context specifications
removeContextlinkData: JsonLD.Thing, context?: string
Generate
The library includes generator functions for common types.
Image
;// type will be JsonLD.ImageObject;
Place
;// type will be JsonLD.Place;
Web page
;// type will be JsonLD.WebPage;
Organization
;// type will be JsonLD.Organization;
Breadcrumb
;// type will be JsonLD.Breadcrumb;
Discover Action
;// type will be JsonLD.DiscoverActiondiscoverActionurl: string
License
Copyright © 2019 Jason Abbott
This software is licensed under the MIT license. See the LICENSE file accompanying this software for terms of use.