tinyscripts
v2.0.1
Published
Tiny Useful Scripts
Downloads
3
Maintainers
Readme
Install
npm i tinyscripts
Usage
base64
const { base64 } = require('tinyscripts');
var encoded = base64.encode('Hello World');
//=> SGVsbG8gV29ybGQ=
base64.decode(encoded);
//=> Hello World
base64.validate(encoded)
//=> true
- base64.encode(str) - Encodes "str" with base64
- base64.decode(base64) - Decodes "str" from base64
- base64.validate(base64) - Validates "str" to see if it is valid base64
camelCase
const { camelCase } = require('tinyscripts');
camelCase('make this camel case')
//=> makeThisCamelCase
- camelCase(str) - Turns "str" into camel case format
charMap & translate
const { charMap, translate } = require('tinyscripts');
var map = new CharMap('hwo', 'uey');
var translation = translate('Hello World', map);
//=> Uelly Eyrld
- charMap(from, to) - Creates a new charMap that can be used with translate() (More Info)
- translate(str, map) - Translates a string based on a charMap. This is similar to the python translate() function.
isUpperCase & isLowerCase
const { isUpperCase, isLowerCase } = require('tinyscripts');
isUpperCase('C')
//=> true
isUpperCase('c')
//=> false
isLowerCase('c')
//=> true
- isUpperCase(str) - Returns true or false depending on if the string is uppercase.
- isLowerCase(str) - Returns true or false depending on if the string is lowercase.
More Info
charMap
charMaps can be used with translate() to replace a charactar in a string with one of another. This is similar to the python translate() function.