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

ismi-node-tools

v0.0.14

Published

some about node

Downloads

61

Readme

is-mi-node-tools

A purely functional tool that includes

  • nodes use

language

install

npm install   ismi-node-tools  --save

file

  • readFileToJson read .json file and return JSON or null
  • readFileToJsonSync synchronous read .json file and return JSON or null
  • fileExist Does the file exist
  • writeJsonFilejson Write data to a blank file

runOtherCode section

  • runOtherCode Run other code
  • RunOtherCodeParam Declaration of parameter types for running other code

npmPkg section

  • npmPkgInfoType type of getNpmPkgInfo returns
  • getNpmPkgInfo get npm package info
  • testNpmPackageExist test a npm package is exist

path section

  • pathJoin File address concatenation
  • pathBasename Provide file path to obtain file name, without file type suffix
  • initializeFile Initialize the paths __filename and __dirname , as they can only be used in the cjs file. They are initialized here and are compatible
  • getCallerFilename Get the file that calls the function
  • isWindows Is it currently in a Windows environment, used to address the differences caused by different time separators when using 'path'
    • getDirectoryBy Find the parent directory of the target based on its file or file name

cursor section

You can use cursor to manipulate the cursor position:

| Method | Schematic | Parameters | | :---------------------: | :-------------------------: | :---------------------------------------------------: | | t | \u001B | -- | | _p | on node environment print | r print string; lineFeed line feed,default true | | cursorHide | cursor hide | -- | | cursorShow | cursor show | -- | | cursorPositionSave | Store cursor position | -- | | cursorPositionRestore | Restores cursor position | -- | | cursorMoveUp | cursor Up | numberOfUpwardMoves offset, default to 1 | | cursorMoveDown | cursor Down | numberOfMovesDown offset, default to 1 | | cursorMoveLeft | cursor Left | numberOfLeftShifts offset, default to 1 | | cursorMoveRight | cursor Right | numberOfRightShifts offset, default to 1 | | cursorAfterClear | clear all after cursor | -- |

readInput section

A function waiting for user input. Because it needs to wait, it is asynchronous, and when using it, wait should be used

import { readInput } from "ismi-node-tools";

const callBackFunction = (keyValue: string | undefined, key: any) => {
  if (key.name && key.name == "return") return true;
  else
    return console.log(
      `Try a different key, this key (${keyValue}) do not execute exit`
    );
};

Color section

The string color value of the terminal (meaning it cannot be used in a browser environment, (in fact, browsers have a simpler implementation method) :

Color static method

| method | rgb 色值 | | Hexadecimal color value | | :---------------: | :------------------: | :------------------------: | | fromHexadecimal | --- | --- | | fromRgb | --- | --- | | random | --- | --- | | darkBlack | rgb(86 ,86 ,86) | #565656 | | darkRed | rgb(181 ,40 ,29) | #b5281d | | darkGreen | rgb(50 ,181 ,32) | #32b520 | | darkYellow | rgb(160 ,160 ,29) | #a0a01d | | darkBlue | rgb(64 ,10 ,217) | #400ad9 | | darkMagenta | rgb(201 ,24 ,201) | #c918c9 | | darkCyan | rgb(45 ,174 ,187) | #2daebb | | darkWhite | rgb(193 ,193 ,193) | #c1c1c1 | | lightBlack | rgb(111 ,111 ,111) | #6f6f6f | | red | rgb(252 ,33 ,25) | #fc2119 | | green | rgb(47 ,232 ,26) | #2fe81a | | yellow | rgb(232 ,236 ,20) | #e8ec14 | | blue | rgb(74 ,3 ,254) | #4a03fe | | magenta | rgb(251 ,0 ,253) | #fb00fa | | cyan | rgb(255 ,255 ,255) | #ffffff |

use Color

import { Color, _p } from 'ismi-node-tools';

/** `_Color` does not necessarily have to ce used together with `_p` ,`_p` is just the encapsulation of `process.stdout.write` */

_p(
  `${Color.red(
    `Red start${Color.yellow('The middle is yellow')} and the red ending`,
  )}`,
);

_p(Color.random('Randomly print a string of color values'));

If you have any questions, you can directly submit question