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 🙏

© 2025 – Pkg Stats / Ryan Hefner

fragrant

v3.4.8

Published

+ [Github HomePage](https://github.com/TheTimelessX/fragrant)

Downloads

43

Readme

Fragrant Module

Installation

npm i fragrant

Constructor Options

  • workingOn: string[] -> parsing this list, it allows you to use other string lists, default is process.argv .

  • usage: string -> the main and basic usage of your project, it depends on sensitivity mode .

  • emitUndefineds: boolean -> if a value was undefined it would emit it (if emitUndefineds was true)

  • sensitivity: high | low -> if you set sensitivity on high, it will log the usage banner when no argument inputted, but low wont log anything .

Listening Modes

  • call: it will emit "find" event when your argument called, value is going to be true;

  • middle: it will emit "find" event when your argument called and carry an object (string or undefiend) . for example: --path /usr/bin

  • store: it will emit "find" event when your argument called and carry an object (string or undefiend) . for example: --path=/usr/bin

Kinds for Flags

  • optional (default)
  • literal -> if flag didnt call and its kind was literal, the help of flag will log, default message log is invalid syntax detected while using program

Usage


const { Fragrant } = require("fragrant");

let fragrant = new Fragrant({ sensitivity: "high", usage: "USAGE: -h / --help\n\n..." });

// add a fragrant

let readfileHelp = "-r / --read : for reading a file";

fragrant.add("call", [{ flag: "--help", kind: "optional" }, { flag: "-h", kind: "optional" }]);
fragrant.add("middle", [ { flag: "--read", kind: "literal", help: readfileHelp }, { flag: "-r", kind: "literal", help: readfileHelp }]);

// or seeing details
let theHelpFlags = fragrant.add("call", [{ flag: "--help", kind: "optional" }, { flag: "-h", kind: "optional" }]);
console.log(theHelpFlags);

/*
output:
 [
  {
    flag: '-h',
    type: 'call',
    id: '88843ebd-461c-48f1-a35e-0a46336bb3d1'
  },
  {
    flag: '--help',
    type: 'call',
    id: '49a4d6eb-11a2-4e45-9389-7e05a958f2a8'
  }
 ]
 */

// seeing what you added
let storage = fragrant.catchStorage();
console.log(storage);

// remove a flag by its flag id
let theHelpFlag = fragrant.add("call", "--help");
fragrant.remove(theHelpFlag[0].id);

// or 

let theFlags = fragrant.add("call", "-r", "--read");
let theFlagIds = theFlags.map(flag => flag.id);
fragrant.remove(theFlagIds);

// the events: find
fragrant.on("find", (args) => {
    console.log(args);
    /*
    output should be:

    {
        type: 'call',
        value: true,
        id: '7c7e93a3-bed8-477c-b16c-9613d11626da'
    }

    {
        type: 'middle',
        value: 'hi',
        id: '7c7e93a3-bed8-477c-b16c-9613d11626da'
    }
    
    {
        type: 'middle',
        value: undefiend,
        id: '7c7e93a3-bed8-477c-b16c-9613d11626da'
    }

    {
        type: 'store',
        value: 'hello world',
        id: '7c7e93a3-bed8-477c-b16c-9613d11626da'
    }
    
    {
        type: 'store',
        value: undefiend,
        id: '7c7e93a3-bed8-477c-b16c-9613d11626da'
    }
    */
})

// parse the args handler
// notice: always call it when you added your flags and listeners
fragrant.parse();

// delete everything
fragrant.clear();

Something Interesting !

  • as i said you can edit the string list, the working list

  • for example:


const sampleString = "--get 'hello world' --close"

const { Fragrant } = require("fragrant");

let fragrant = new Fragrant({ workingOn: sampleString.split(" "), sensitivity: "high", usage: "USAGE: -h / --help\n\n..." });