Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

content-state

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-state

A library for working with IIIF Content State annotations

  • 0.9.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

ContentState.js

API

Classes

ContentStateError

This is the custom Error class we're assuming we'll throw on parse errors.

Functions

expandAnnotation(annotation)Object

Given a contentState annotation, add back in the context if it's missing. Given a mimimal target-only contentState, assume that it's a target and wrap it in the annotation.

validateAnnotation(annotation)

Given an annotation, confirm that it has the correct context and that it has a target property. Will throw errors if it is not.

isContentStateAnnotation(annotation)Boolean

Inspect the motivation of an annotation and see if it contains the "contentState" motivation.

encodeLink(url, annotation)string

Helper function to create a full link that includes the annotation param.

parseURL(url)Object

Extract the annotation information from a full URL

expandAnnotation(annotation) ⇒ Object

Given a contentState annotation, add back in the context if it's missing. Given a mimimal target-only contentState, assume that it's a target and wrap it in the annotation.

Kind: global function Returns: Object - the annotation with any transformations applied

ParamTypeDescription
annotationObjectthe annotation to expand

validateAnnotation(annotation)

Given an annotation, confirm that it has the correct context and that it has a target property. Will throw errors if it is not.

Kind: global function

ParamTypeDescription
annotationObjectthe annotation to expand

isContentStateAnnotation(annotation) ⇒ Boolean

Inspect the motivation of an annotation and see if it contains the "contentState" motivation.

Kind: global function Returns: Boolean - true if it's a contentState Annotation, false if not.

ParamTypeDescription
annotationObjectthe annotation to inspect

encodeLink(url, annotation) ⇒ string

Helper function to create a full link that includes the annotation param.

Kind: global function Returns: string - The augmented URL

ParamTypeDescription
urlstringThe URL that should have a contentState param added.
annotationObjectThe annotation Object

parseURL(url) ⇒ Object

Extract the annotation information from a full URL

Kind: global function Returns: Object - The annotation data and manifest value

ParamTypeDescription
urlStringThe URL to parse

Credits

Keywords

FAQs

Package last updated on 01 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc