1.0.6 • Published 2 years ago

@costantino03/javascript-starter-library v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

requiring the library

const js_starter = require("@costantino03/javascript-starter-library")

what does jsonparse do?

it parses a json object from a stringed json object into a json object

var object = '{"name":"Test","City":"New York"}'
var result = js_starter.jsonparse(object)
//result :
{"name":"Test","City"."New York"}

what does jsonreadable do?

it takes an stringed/not stringed json object and it puts in a readable format

var object = {"name":"Test","City":"New York"}
var result = js_starter.jsonreadable(object,spaces)
//result:
{
   "name": "Test",
   "City": "New York"
}
/*
the spaces argument is optional and the default value is 3
and you can pass even pass the stringed version of a json object and 
it will parse it and make it readable
*/

what does char_replacement_m do?

it takes a string and replaces all occurrences of a specific character

var string = "Hello-World"

var result = js_starter.char_replacement_m(string,"-"," ")

console.log("Before: "+string)

console.log("        ")

console.log("After: "+result)

/*
Terminal output:

Hello-World

Hello World
*/

what does getdsrole do?

first thing this function runs with discord.js 12.2.0

you pass the current discord.js instance(after the login)

returns the id of the specified role name

var role_name = "Admin"

var role_id = js_starter.getdsrole(discord-js_instance,role_name)

what does number_gen1 do?

it takes a a maximum value and it goes from 1 to the specified number

var result = js_starter.number_gen1(5)

console.log(result)

what does number_gen2 do?

it takes a a maximum and minium value and it goes from minium specified number to the maximum specified number

var result = js_starter.number_gen2(5,10)

console.log(result)

what does n_formatter do?

it takes a number and add commas to the number

var formatted = js_starter.n_format(1500)

console.log(formatted)

/*
terminal output:
1,500
*/

what does calc_percent do?

it takes 2 values, a current and a target and it calculates the percentage you are at

var percentage = js_starter.calc_percent(50,100)

console.log(percentage)
/*
terminal output:
50
*/

what does calc_percent_left do?

it takes 2 values, a current and a target and it calculates the percentage remaining to reach the target

var percentage = js_starter.calc_percent_left(50,150)

console.log(percentage)
/*
terminal output:
66.66
*/
1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago