New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tool-lib

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tool-lib

Common tools of JS

latest
Source
npmnpm
Version
0.0.9-1
Version published
Maintainers
1
Created
Source

npm i tool-lib

All modules are asynchronous-based
如果你能看懂中文,那么你可以看包里的README_zh.md

Import module

const _tool=require('tool-lib');

CEP Import module

const _tool=require('tool-lib/cep');

Use:

  • Remove null values from JSON _tool.clearJsonNull(json);

  • Determine the incoming data type and return a string _tool.dataType(obj);

  • Recursive creation of directories _tool.mkdir(dir)

  • CEP version Recursive creation of directories _tool.cep_mkdir(dir)

  • Converting Boolean values of strings to Boolean values _tool.strBol(str)

    • const a='true'; console.log(typeof(_tool.strBol(a)));//boolean
  • Determine whether the specified position of the array is a number _tool.arrIsNum(data,num)

    • Returns Boolean values
  • Returns which array element appears in the string and returns the subscript of the array _tool.arrIsNum(data,num)

    • return JSON
  • How many decimal places to take _tool.float(num,n[,option])

    • return num
      • [option]The default is '1',example:_tool.float(3.25335,2)//3.25
      • If the parameter is'0', then use the following complement'0';example:_tool.float(3.25,4,0)//3.2500
  • Returns the index of the closest value _tool.nearIndex(arr,val)

    • return index
      • example:let arr=[[3.56,4,5,2.25,8]];arr[await _tool.nearIndex(arr,1)]//2.25
  • Compare the values in json, and return true if matched _tool.compareJson(json,val)

    • If the match returns true
  • Hardware information of this machine _tool.localHardwareInformation const info=_tool.localHardwareInformation

    • info.ipv4 {ip,mac,netmask,cidr}
    • info.ipv6 {ip,mac,netmask,cidr}

Keywords

js

FAQs

Package last updated on 25 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts