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 🙏

© 2024 – Pkg Stats / Ryan Hefner

post-type-discovery

v1.0.4

Published

A Javascript implementation of the [Post Type Discovery](https://www.w3.org/TR/post-type-discovery/) W3C spec.

Downloads

112

Readme

post-type-discovery

A Javascript implementation of the Post Type Discovery W3C spec.

Build Status Coverage Status Inline docs devDependencies Status dependencies Status

Installation

Use npm to install:

npm install post-type-discovery --save

Usage

The library exposes just one method that tells you the type of a post given a parsed microformats JSON.

var getType = require( 'post-type-discovery' );

// You can get parsed mf2 using a library like microformat-shiv, or microformat-node
var mf2 = {"items":[{"type":["h-entry"],"properties":{"author":[{"type":["h-card"],"properties":{"name":["Tantek \u00c7elik"],"photo":["http://tantek.com/logo.jpg"],"url":["http://tantek.com/"]},"value":"Tantek \u00c7elik"}],"name":["\ud83d\udcd5 started reading \u201cThe Eight Limbs of Yoga\u201d by Stuart Ray Sarbacker and Kevin Kimple. tantek.com/isbn/086547768X #yoga"],"category":["yoga"],"url":["http://tantek.com/2017/200/t1/started-eight-limbs-of-yoga"],"uid":["http://tantek.com/2017/200/t1/started-eight-limbs-of-yoga"],"syndication":["https://twitter.com/t/status/887903244676214784"],"published":["2017-07-19T22:08-0700"],"updated":["2017-07-19T22:08-0700"],"content":[{"html":"\ud83d\udcd5 started reading \u201cThe Eight Limbs of Yoga\u201d by Stuart Ray Sarbacker and Kevin Kimple. <a class=\"auto-link\" href=\"http://tantek.com/isbn/086547768X\">tantek.com/isbn/086547768X</a> #<span class=\"p-category auto-tag\">yoga</span>","value":"\ud83d\udcd5 started reading \u201cThe Eight Limbs of Yoga\u201d by Stuart Ray Sarbacker and Kevin Kimple. tantek.com/isbn/086547768X #yoga"}]}}]};

// Get the post type
var type = getType( mf2 );

The code is small, easy to read, and documented.

Contributing

Feel free to send pull requests, add test cases, and raise issues. To setup a development environment clone the repo and install dependencies.

$ npm install

# Lint, hint, and run tests
$ npm test

# Run just the tests while developing
$ npm run jest -- --watch

# Build the docs
$ npm run docs