Socket
Socket
Sign inDemoInstall

utilx

Package Overview
Dependencies
3
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    utilx

Some tiny tool functions.


Version published
Weekly downloads
1K
decreased by-45.43%
Maintainers
1
Install size
399 kB
Created
Weekly downloads
 

Readme

Source

utilx

Some tiny tool functions.

home

{String} the home path

isArray(o)

isString(o)

isNonEmptyString(o)

isNumber(o)

isInteger(o)

split(str, delim = ',')

split([])  =>  []
split('1,2,3') => [1, 2, 3]
split('1,,2,,3', ',,')  => [1, 2, 3]

camelcase(str)

camelcase('is-array')  =>  'isArray'

unCamelcase(str)

unCamelcase('isArray')  => 'is-array'

isExistedFile(p)

isExistedDir(p)

readFile(p, encoding = 'utf8')

writeFile(p, data)

This function will create the dir first if necessary.

remove(p)

Remove specified dir or file. If the path is not existing, this function will do nothing.

readJSON(p)

This function will return an empty JSON object if any error occurs.

writeJSON(p, data, space = 0)

noCacheRequire(fullPath)

mix(target, src, overwrite = false)

Mix properties form src to target.

Multiple src is ok, e.g: var target = mix(target, src1, src2, src3)

getExternalIpAddress()

generateLine(len, symbol = '-')

generateLine(4)  =>  '----'
generateLine(2, '=*')  =>  '=*=*'

cGetCfg(commander)

Get options from parsed commander.

var commander = require('commander')
commander.parse(process.argv)
var cfg = cGetCfg(commander)

cGetHelp(pkg)

Return a function to generate help info for commander.

var commander = require('commander')
var pkg = require('../package')
commander.helpInfomation = cGetHelp(pkg)

isUrl(p)

isKeyword(p)

Keywords

FAQs

Last updated on 21 Jan 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc