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

validatorio

v1.0.4

Published

Fast, flexible & lean implementation html validator/extractor. Ultimate tool for frontend developer, crawler, SEO optimize.

Downloads

2

Readme

Validatorio

Fast, flexible & lean implementation html validator/extractor best fit for frontend developer,frontend tester, crawler, SEO optimize.

Installation

  • If you don't need to run the validatorio as a command line tools, and use as a library for your nodejs application:
npm install validatorio
  • If you need to run the validatorio as a command line tool, you need install it's as global: npm install validatorio -g

  • Check if validatorio commandline is installed global: validatorio

  • Or installed as local package: node ./node_modules/validatorio/bin/cli.js

How to use:

For developer

import validatorio from 'validatorio';
import rules from '/path/to/rules'

var result = validatorio.valid(rules,html_need_totest);

Use linux pipe style

  • Full support most common request library on linux/macos: wget, curl: curl https://www.shopback.sg -s -H 'Cache-Control: no-cache' | validatorio

  • Full support most common linux commands: cat /path/to/input.html | validatorio > /path/to/output.txt

  • Flexible output: to console, to a file: cat /path/to/input.html | validatorio

With command line arguement

  • Specicic where to load rules, input html need to valid and where to export the result: validatorio -i /path/to/input.html -o /path/to/output.txt -r /path/to/rules.js

  • Display full arguments list with help: validatorio -h

Mixin style

  • Free to mixin pipe linux and arguement style
 cat /path/to/input.html | validatorio -o /path/to/output.txt;
 validatorio -i /path/to/input.html > /path/to/output.txt;

Customize:

Add A custom rule:

  • Check config/rules.js for predefined valid rules.
  • A valid rule is defined by an object with following property:
	{
		description: "Testing rule description is *required*",
		selector: "a css3 selector is *required*",

		# A condition is *option*. Default value: { greater: 0 }
		condition: 
		{
			greater: 0,
			# You can add many combined condition in OR expreesion
			# lower: 100, 
			# equal: 200,
		},
		
		# a callback function can customize if you want more customize the result, 
		# if not provided the default value is result.length
		callback: function(result){
			return result.text().length
		},

		# a debug flag is a optionto show rule debug with css selector result. 
		# Default value: false
		debug: true,

		# a boolean trigger is *required*, boolean trigger can be true or false
		# provided boolean trigger will be fire after the condition expression apply to return result:
		false: "Message you want to display if result is false, you can pass {value} to show the css selector result you expect"
		//true: "Message you want to display if result true."
	}	
  • A rule can be defined by a json file, check config/rule.json for example. json rule can't use with use with callback customize

Customize css selector engine:

  • Use jquery selector instead of cheerio on browser enviroment:
validatorio.loadSelector = (html) => {
	return jQuery;
}

Features

  • Free to customize the css selector engine.
  • Wide enviromnet support, work good on both browser enviroment and server side
  • A ultimate command line buildin.
  • Full Customable condition rules and parser.
  • CSS3 selector, jquery friendly syntax.

Todo Lists

  • A simple test integrate with https://cypress.io a modern frontend testing tool.
  • Add more testing rules preset.
  • A html reporter to easy to publish the testing result to browser.

Built With

  • cheerio - A jquery like library for server side.
  • commander - A library for nodejs command line interface, make geek more geek.
  • color - Make black/white into colors.

Acknowledgments

  • css3 selector. very few frontend development with javascript if you want detail customize

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details