npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@advance-labs/schema-validator

v0.2.2

Published

Detect and validate JSON-LD, Microdata, and RDFa structured data from raw HTML, mapped to schema.org types with AEO-relevant required-property validation.

Readme

@advance-labs/schema-validator

Detect and validate all three structured-data encodings — JSON-LD, Microdata, and RDFa — from a raw HTML string, then map every item to its schema.org short type and check the required properties that matter for answer-engine optimization (AEO). This is a clean-room TypeScript rebuild of the structured-data-testing-tool capability. It is pure and network-free: HTML is parsed in-process with cheerio, so it is fully unit-testable without live HTTP.

Usage

import { analyzeStructuredData } from '@advance-labs/schema-validator';

const html = await fetchHtmlSomehow(url); // I/O is the caller's responsibility
const report = analyzeStructuredData(html, url);

console.log(report.aeoTypesPresent); // e.g. ['FAQPage', 'Organization']
console.log(report.invalidCount);    // items missing required properties
for (const item of report.items) {
  if (!item.valid) console.warn(item.type, 'missing', item.missingRequired);
}

The low-level extractors operate on a loaded cheerio document if you need finer control:

import * as cheerio from 'cheerio';
import { extractJsonLd, extractMicrodata, extractRdfa, validateItem } from '@advance-labs/schema-validator';

const $ = cheerio.load(html);
const items = [...extractJsonLd($), ...extractMicrodata($), ...extractRdfa($)];
const result = validateItem('FAQPage', { mainEntity: [/* ... */] });

Public API

| Export | Signature | Purpose | |--------|-----------|---------| | analyzeStructuredData | (html: string, url: string) => StructuredDataReport | Run all extractors and roll up a report with AEO presence flags. | | extractJsonLd | ($: CheerioAPI) => StructuredDataItem[] | JSON-LD from <script type="application/ld+json">, flattening @graph and arrays. | | extractMicrodata | ($: CheerioAPI) => StructuredDataItem[] | Microdata via itemscope / itemtype / itemprop, with nested items. | | extractRdfa | ($: CheerioAPI) => StructuredDataItem[] | RDFa Lite via vocab / typeof / property, with nested resources. | | validateItem | (type: string, properties: Record<string, unknown>) => ValidationResult | Check required properties for a (possibly multi-) schema.org type. | | toShortType | (raw: string) => string | Collapse any schema.org type reference to its short name. | | normalizeTypes | (value: unknown) => string[] | Normalize a @type string/array to ordered, de-duplicated short names. | | isAeoSchemaType | (shortType: string) => shortType is AeoSchemaType | Narrow to the AEO-relevant schema.org type set. |

All report/item shapes (StructuredDataReport, StructuredDataItem, StructuredDataFormat, AeoSchemaType) are imported from @advance-labs/types and never redefined here.

Validated types

Required-property validation is enforced for the key AEO types: FAQPage (mainEntity with Question + acceptedAnswer), QAPage, HowTo (step), Article / NewsArticle / BlogPosting (headline), Person (name), Organization (name), BreadcrumbList (itemListElement), Product (name), Review (reviewRating), and LocalBusiness (name + address). Unknown types are passed through as valid: true (we only assert rules we have defined).

Status

Implemented — all three extractors, schema.org type normalization, AEO required-property validation, and the aggregate report are fully implemented with no stubs. No live network or filesystem I/O: callers supply the HTML.