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

octopinion

v1.4.0

Published

Create a html box for entering reviews

Readme

WHAT IS IT

octopinion is a very basic and simple npm package that will help you integrating Octopinion in your website. Octopinon is a tool designed to analyse reviews in your web and retrieve very useful information from them.

HOW TO USE

  • Install the package.
  • Genrate the source file from product key.
  • Use generated js file in the client.

Install the package

npm install --save octopinion
// package.json
{
  "dependencies": {
    "octo-npm": "^1.**"
  }
}

Import it in the server.

  • Using ES6

import Octo from 'octopinion';
  • Using ES5

var Octo = require("octopinion");

MAKE IT AVAILABLE IN THE BROWSER

Generate source file from product key, so that you make octopinion available for the browser.

The following code needs to be run in the serve and will generate the source file used in the client. Place it within your project.


new Octo('key','username', 'path');
  • param key -> Find the key in your Octopinion user dashboard.
  • param username -> Your username in Octopinion.
  • param path -> a relative path. For example './' where the file is going to be built. './' will generate the js client file in the same directory where you are executing the function.

Now import the js in your html:


<script src="./bundleBuild.js"></script>

<script>
    
    octoClient ...
</script>

USING TYPESCRIPT

When running the Octo constructor you will also have available the client. Hence, export the client to in order be available in client side.

//Get an instance of Octo in the server side and export only the client.
const octo = new Octo('key','username', 'path');
...
//set options
...
export default octoClient = octopinion.octoClient;
//Import the client and use it
import octoClient from 'the above ts file';

NOTE: Look at the typings in octopinon typings package

Insert reviews built box where ever.

Have a look into test/test.html in order see an example.

   /*
    * Pass the element where you want to inject the reviews box and the section where you want to link new reviews.
    */
    octoClient.insertInto(document.getElementById('where'), 'some_product_section');

CHANGE PARAMETERS

  • userKey -> Key identifying the logged user.
    /**
     * Add the user that is loggged in your web. 
     * If you have a user logged, should be this one.
     * Default value is annonymous.
     */
    octoClient.setUserLoggedKey('user-logged-name');
  • pageSize -> Number of reviews per page.
    /**
     * Change the page size. Default page size is 20 elements.
     */
    octoClient.setPageSize(3);
  • insertLastReviews -> If last reviews have to be displayed.
    /**
     * Insert last reviews box. 
     * Default value is true.
     */
    octoClient.setInsertLastReviews(true);
  • hideWhenNotLogged -> It will hide the textarea to set reviews when userkey is not set.
    /**
     * Hides the textarea when userkey is not set
     */
    octoClient.setHideWhenNotLogged(true);
  • disableWhenNotLogged -> It will disable the textarea to set reviews when userkey is not set. If the property above is set to true it will override this one, hence, it will not show the textarea if the user key is not set.
    /**
     * Disables the textarea when userkey is not set.
     */
    octoClient.setDisableWhenNotLogged(true);
  • dateFormat -> Change the date format for the reviews list. The default is 'DD MMM YYYY'

    octoClient.setDateFormat('DD MM YYYY');
  • showMoreApproach -> The dafault uses this approach. When set to fasle it will render four buttons. First, next, previous, last.

    octoClient.setShowMoreApproach(true);
  • It is possible to change all properties above usin setOptions function.
    /**
     * Change all properties above.
     */
    octoClient.setOptions({pageSize: 3, insertLastReviews: true, userKey: 'logged-user-name', disableWhenNotLogged: true, hideWhenNotLogged: true, dateFormat: 'DD MM YYYY', showMoreApproach: true});
  • callback -> Callback function to be executed when a new review has been analised.
    /**
     * Function to be executed when a new review has been analized.
     * 
     * interface Founds {
     *   word: string; //Word might be empty if no noun is related to the positive/negative.
     * }
     * 
     * interface AnalizedResponse {
     *  status: string;
     *  message: string;
     *  positiveFound: Founds[];
     *  negativeFound: Founds[];
     *  processedText: string;
     * }
     */
    octoClient.setCallback(function(data){console.log('Analized response', data);});

Note: Have a look at the examples in test/test.html

LIMITATIONS

  • Paginating only with next, previous, last and first buttons or using a showmore button.
  • Using icons from font-awesome.
  • CSS classes are not changeable.
  • Only working for ES6