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

stare.js

v1.2.2

Published

Aplicación de testing para el modulo Stare.js

Readme

Stare.js

Stare.js is a project that seek facilitate to developers the creation of alternative visualizations for search engine results, providing key functionalities to clean, manage, extract characteristic and create visualization of SERPs (Search Engine Result Pages).

  • Extensible
  • Modular
  • Potentially Scalable
  • Open Source
  • Reduce your Codelines

Resources

Installation

Dillinger requires Node.js v4+ to run.

Install the dependencies and devDependencies and start the server.

$ npm install -stare.js

Extensions

Stare.js is currently extended with the following plugins, all of them developed as part of the proof of concept.

| Plugin | Function | | ------ | ------ | | Legibility | Reading Ease for English and Perpiscuity for Spanish| | Language | Detect the most probable language for a document | Length of Documents | Calculate the length in characters of a Document | Support for Google SERPs | Handler for SERPs obtained through the Google Custom Search JSON API | Support for Ecosia SERPs | Handler for SERPs obtained from ecosia through a web scrapper | Bubble Chart Visualization | Simple bubble chart visualization | Bar Chart Visualization | Simple bar chart visualization

Back-End Usage

Import the package.

const stare=require('stare.js').stare;

Define Metrics to calculate. Each Metric must be adressed by its name.

var metrics= ['length','ranking', 'language', 'perpiscuity'];

Pre Process the SERP and extract characteristics:

//var SERP contains the SERP
...
stare.prepareSerp('ecosia_serp', SERP)
            .then(function(SERP){
                //This code is executed after the SERP preparation
                //The necesary metrics are required:
                stare.get_Metrics(...metrics);
                //To Get the SERP:
                var Json= stare.get_Json();
                ...
               });

The resultant SERP (standard) has the following structure:

{
"resultados": number,
"terminos": String[],
"items": number,
"start": number,
"documents": Document[{
    "title": String,
    "link": String,
    "snippet": String,
    "image": Images[{
        "width": number,
        "height": number,
        "src": String
        }]
    }]
}

Front-End Usage

In the front end of the app, import the visualization module:

const bubbleChart = require('stare.js/visualizations').bubbleChart;

Define the variable that will contains the chart and set parameters:

var chart;
var t = 500; //time to update data in ms.

Create the chart and configurate internal parameters:

chart = bubbleChart()
                .height(600)
                .width(700)
                .forceApart(-600)
                .maxRadius(70)
                .minRadius(10)
                .attrRadius("length")
                .transition(1000)
                .showTitleOnCircle(true)
                .customColors("perpiscuity", "A3", false);

Finally, pass the data and update the chart if needed:

//var json contains processed SERP
...
d3.select('#chart').datum(json).call(chart);
interval = setInterval(
            () => updateDataBubbleChart(){
                ...
                //get updated data in json using get_json().
                d3.select('#chart').datum(json).call(chart);
            }, t
        );

Include New Extensions

To add new characteristics through extensions you will have to add the script in the corresponding component of the pachage as indicated below:

1. SERP Handler

To add a SERP handles you must create a JavaScript file named searchEngineName_serp.js and include it in the directory: Stare/Serp_Process/

The Extensión must have the following structure (Is important to maintain the names of the methods):

//imports
  ...
  //Logic of the format transformation.

  //Suport Functions
  ...
  let clearJson= function(file){
        ...
        return(StandardJsonObject)
  }
  //input managment.
  let pre_procesar= function(input, output){
   return new Promise(function(resolve, reject){
       if(typeof(input)==="string"){
           console.log("String Received");
           var file= loadJson(input);
           file= clearJson(file);
           resolve(file)}
       else{
           console.log("Object Received");
           file= clearJson(input);
           resolve(file)}
   })};

    //module exportation
    module.exports= {
       pre_procesar
    };

And that's all! Now, to use it, the name of the script must be passed as a paremeter when calling the function

stare.prepareSerp('searchEngineName_serp', SERP)

2. Characteristic Extractor

To add an extension to this component, it must be created a JavaScript file called nameCharacteristic.js and added it to: Stare/metrics/.

This file must have the following structure (Is important to maintain the method names):

//import dependencies

//support functions
    ...

//function that calculate the metric:
    var get_value= function(input, index) {
        return new Promise(function(resolve, reject){
        var name_var;
    	resolve([name_var, "name_var", index]);
    	reject(false)
	}

//type of input required
    var use_DOC= function(){return true},
        use_HTML= function(){return false},
    	use_SERP= function(){return false};

//Funtion Export:
    module.exports= { get_value };

the "name_var" will be the name used to use this component in the future. The implementation

3. Visualization

To add an extension to this component, it must be created a JavaScript file called nameVisualization.js and added it to: Stare/visualizations/.

This file must have the following structure (Is important to maintain the method names):

 //Imports
    const d3 = require('d3');
    const palettes= require('./ColorPallettes.js');

 //Chart Function
    function nameVisualization(){
        ...
    }
 //Module Export
    module.exports={
        nameVisualization
    };

The implementation of the visualization must be done following the method chain notation, to allow the setting of parameters through this mechanism.

License

Atribución 3.0 Chile (CC BY 3.0 CL) Author: Camila Márquez. Mail: [email protected]

Free Software, Hell Yeah!