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

check-seo

v1.0.2

Published

SeoCheck module is build to check if there is/are any irregularites in your HTML file. You can customise your own set of rules to check if your end requirements are met.

Downloads

4

Readme

SeoCheck

SeoCheck module is build to check if there is/are any irregularites in your HTML file. You can customise your own set of rules to check if your end requirements are met.

npm npm

Install via npm

npm i check-seo
npm test

Usage

Load all the modules

const fs = require('fs');
const {Configure, Rule, Writer, Reader} = require('check-seo');

// Or load individual modules 
const Configure = require('check-seo').Configure;
const Rule = require('check-seo').Rule;
const Writer = require('check-seo').Writer;
const Reader = require('check-seo').Reader;

Rules Available

RuleAllContainTagAttribute(parentTag, tagSearch, attributeSearch, valueSearch(optional))
RuleMaxTagAttribute(parentTag, tagSearch, attributeSearch, valueSearch or '', maxCount)
RuleExistsTagAttribute(parentTag, tagSearch, attributeSearch, valueSearch(optional))
RuleMaxTag(parentTag, tagSearch, maxCount)
RuleExistsTag(parentTag, tagSearch)

Example

// To write data to console 
var writeConsole = new Writer.writeConsole()
// To write data to file
var writeFile = new Writer.writeFile('path/to/outputfile');
// To write data to file stream
var writeFilestream = new Writer.writeStream(fs.createWriteStream('path/to/outputfile'));

var rules = [];
//Check if all tag contains attribute eg. all <img> contain alt attribute
rules.push(new Rule.RuleAllContainTagAttribute('', 'img', 'alt'));

//Check <img alt> tag count greater than 4 
rules.push(new Rule.RuleMaxTagAttribute('', 'img', 'alt', '' ,4));

//check parent contains <tag attribute> eg: body containg <img alt>
rules.push(new Rule.RuleExistsTagAttribute('body', 'img', 'rel'));

//check parent contains <tag attribute=value> eg: head contains  <meta name="keywords">
rules.push(new Rule.RuleExistsTagAttribute('head', 'meta', 'name', 'keywords'));

//check if parent contains <tag> eg: body conatins <img>
rules.push(new Rule.RuleExistsTag('body', 'img'));

//check tag count: parent contains <tag> eg: body conatins <img>
rules.push(new Rule.RuleMaxTag('', 'strong',5))


var config1 = new Configure(new Reader.readStream(fs.createReadStream(path/to/input)), writeConsole, rules);

config1.validate(function(err, data){
      console.log(err);
      console.log(data);
});