2.0.1 • Published 3 years ago

tinyscripts v2.0.1

Weekly downloads
10
License
ISC
Repository
github
Last release
3 years ago

npm npm size

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.