Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including with all npm packages installed. Try it out:

var schemaOrg = require("")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors. v3.1.1 in JS (wip)


styled with prettier

Work in progress...


import context from '';



data is an optional array of flattened JSON-LD document containing RDFS definition of extension.

import SchemaOrg from '';
var schemaOrg = new SchemaOrg();


returns the RDFS node corresponding to the term;

{ '@id': 'schema:MedicalScholarlyArticle',
  '@type': 'rdfs:Class',
  comment: 'A scholarly article in the medical domain.',
  label: 'MedicalScholarlyArticle',
  subClassOf: [ 'schema:ScholarlyArticle' ] }

SchemaOrg.prototype.getSubClasses(type[, recursive])

returns a set containing the sub classes of the type. if recursive is false (default value is true) only the direct descendant are returned.

schemaOrg.getSubClasses('Article', false)
Set {
  'TechArticle' }


returns a set representing the trail of parent classes.

Set { 'ScholarlyArticle', 'Article', 'CreativeWork', 'Thing' }, type)

returns true if value (or list of thereof) is a type'MedicalScholarlyArticle', 'Article') === true

SchemaOrg.prototype.getType(obj[, minType])

Infer the type of the object obj and returns undefined when no type can be safely inferred (multiple options). If minType is specified the returning type must be at least as specific or more specific than minType.

  "name": "a name",
  "videoQuality": "video quality",
  "transcript": "a transcript"
}) ===  'VideoObject'


import * as utils from '';


npm test


Apache 2.0

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free