arrayify
Transform the given values into an array.
arrayify(val: any): array
Parameters
val
(any)
value
Returns
array
:
array
Example
var snu = require('s-node-utils');
snu.array.arrayify('abc');
//=> ['abc']
string
Determines if the string is a string.
Parameters
string
(string)
string
Returns
boolean
:
boolean
Example
var snu = require('s-node-utils');
snu.is.string('text');
//=> true
zalgo
Determines if the string consists of zalgo text.
Parameters
Returns
boolean
:
boolean
Example
var snu = require('s-node-utils');
snu.is.zalgo('ť͈̓̆h̏̔̐̑ì̭ͯ͞s̈́̄̑͋');
//=> true
int
Give a random number between 2 given numbers
Parameters
Returns
number
:
number
Example
var snu = require('s-node-utils');
snu.math.random.int(0, 5);
//=> 3
progressBar
Generate a progress bar
Parameters
percentage
(number
= 0
)
Percentage (out of 100)
totalSteps
(number
= 10
)
Number of characters
complete
(string
= "█"
)
Character (completed)
empty
(string
= "▒"
)
Character (empty)
Returns
string
:
bar
Example
var snu = require('s-node-utils');
snu.others.progressBar(5, 10);
//=> █████▒▒▒▒▒
snu.others.progressBar(44, 50, '!', '|');
//=> !!!!!!!!!!!!!!!!!!!!!!||||||||||||||||||||||||||||
capitalize
Converts the first string character to uppercase.
Parameters
string
(string)
Character string
Returns
string
:
Character string
Example
var snu = require('s-node-utils');
snu.string.capitalize('a text');
//=> A text
chop
Like trim.
Parameters
string
(string)
string
Returns
string
:
boolean
Example
var snu = require('s-node-utils');
snu.string.chop('text');
//=> text
snu.string.chop(' text ');
//=> text
snu.string.chop('-text-');
//=> text
unzalgo
Removes all Zalgo text characters for every word in a string if the word is zalgo text.
Parameters
Returns
string
:
string
Example
var snu = require('s-node-utils');
snu.string.unzalgo('ť͈̓̆h̏̔̐̑ì̭ͯ͞s̈́̄̑͋');
//=> this
zalgolize
Transforms string to zalgo text.
Parameters
Returns
string
:
string
Example
var snu = require('s-node-utils');
snu.string.zalgolize('this');
//=> t̋hiͤsͮ