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

sails-hook-meta

v0.3.1

Published

Sails extension for generating meta header.

Readme

sails-hook-meta

Sails extension for generating meta header.

Installation

$ npm install sails-hook-meta

Usage

Upon installation, a meta object will be added to req.

//-- api/controllers/HomeController.js
module.exports = {
  index: function(req, res) {
    req.meta.set({ name: "title", content: "Page Title" });
    res.view();
  }
};

//-- views/home/index.ejs
<html>
  <head>
    <%- req.meta.toString() %>
  </head>
</html>

//-- output
<html>
  <head>
    <meta name="title" content="Page Title">
  </head>
</html>

Methods

set(attrs)

Returns true if meta attributes are successfully set. Returns false otherwise. The parameter attrs could be an Object or array of Objects. This function tries to keep the meta items unique by looking at primary attributes. Currently, it only checks for name, property, http-equiv and charset values for uniqueness.

req.meta.set({ charset: "utf-8" });
req.meta.set({ name: "Author", lang: "fr", content: "Arnaud Le Hors" });
req.meta.set({ "http-equiv": "Content-Type", content: "text/html; charset=utf-8" });

req.meta.set([
  { property: "og:image", content: "http://example.com/rock.jpg" },
  { property: "og:image:width", content: "400" },
  { property: "og:image:height", content: "300" }
]);

add(attrs)

Similar to set() except that this function doesn't check for uniqueness.

req.meta.add({ charset: "utf-8" });
req.meta.add({ name: "Author", lang: "fr", content: "Arnaud Le Hors" });
req.meta.add({ "http-equiv": "Content-Type", content: "text/html; charset=utf-8" });

req.meta.add([
  { property: "og:image", content: "http://example.com/rock.jpg" },
  { property: "og:image:width", content: "400" },
  { property: "og:image:height", content: "300" },
  { property: "og:image", content: "http://example.com/rock2.jpg" },
  { property: "og:image:width", content: "800" },
  { property: "og:image:height", content: "600" }
]);

remove(attrs)

Returns true if meta item/s is successfully removed. Returns false otherwise.

req.meta.remove({ charset: "utf-8" });
req.meta.remove({ "http-equiv": "Content-Type" });

clear()

Deletes all meta items.

req.meta.clear();

toString()

Returns the meta markup string.

// req.meta.set({ charset: "utf-8" });
// req.meta.set({ "http-equiv": "refresh", content: "30" });

req.meta.toString();

// <meta charset="utf-8">
// <meta http-equiv="refresh" content: "30">

toJSON()

Returns the array of meta objects.

// req.meta.set({ charset: "utf-8" });
// req.meta.set({ "http-equiv": "refresh", content: "30" });

req.meta.toJSON();

// [ { charset: "utf-8" }, { "http-equiv": "refresh", content: "30" } ]