jsimplify
v0.10.1
Published
Additionnal functions and Js improvement
Downloads
6
Readme
JSimplify
JSimplify : additionnal functions and javascript improvements.
Main Objectives
The main objective for this project is to provide additionnal functions to javascript and to rewrite native function in order to improve them.
How to use
Installation
In a terminal, run the following command
npm install jsimplify
Tests
In a terminal, run the following command
npm run jsimplify_tests
Key Features
Here is a list of all the functions present in this project. The list is divided into two parts, the first one concerns the new functions, and the second one, the JavaScript functions that we have rewritten.
New functions
| Function | Description | Usage |
|:---------|:------------|:------|
| isSet(variable) | Determine if the given variable is set.not null and not undefined. | isSet("toto")
|
| areSet(strict, ...variables) | Determine if the given variables are set.if strict set to true, all variables must be not null and not undefined.if stric set to false, only one must be not null and not undefined. | areSet(true, "toto", 2)
areSet(false, ["toto", 2])
|
Rewriten functions
| Function | Description | Usage |
|:---------|:------------|:------|
| Object.prototype.isEmpty() | Determine if the object is empty : {}
. | ({}).isEmpty()
|
| Array.prototype.isEmpty() | Determine if the array is empty []
. | [].isEmpty()
|
| String.prototype.isEmpty() | Determine if the string is empty ""
. | "".isEmpty()
|
| Object.prototype.asString() | Convert the object into a string. | ({}).asString()
|
| Array.prototype.asString() | Convert the array into a string. | [].asString()
|
| String.prototype.asString() | Convert the string into a string. | "".asString()
|
| Number.prototype.asString() | Convert the number into a string. | (2).asString()
|
| Boolean.prototype.asString() | Convert the boolean into a string. | (true).asString()
|
| Function.prototype.asString() | Convert the function into a string. | (() => {}).asString()
|
| Math.average(...numbers) | Calculate the average value of a list of numbers. | Math.average(1, 2, 3)
Math.average(1, [2, 3, ["4", "5"]])
|
| Math.sum(...numbers) | Calculate the sum value of a list of numbers. | Math.sum(1, 2, 3)
Math.sum(1, [2, 3, ["4", "5"]])
|
| Math.roundPrecisely(number, precision) | Round a number to the given precision. | Math.roundPrecisely(378.245, 2)
Math.roundPrecisely(378.245, -1)
|
Issues & Pull requests
In order to participate in this project, you must create an issue following the various available templates (bug, improvement, new features, issue).
Once your issue is created, a team member will come to validate or reject the issue.
When the issue is validated, you can create your pull request (PR) and link it to its corresponding issue.
Here are some important rules to follow for issues:
You must provide a minimum amount of information to make the context understandable for everyone.
You must adhere to the code of conduct during any interaction with the project's community.
If you wish to participate in the project, please refer to INTERNAL.md to understand the rules and standards established for the project.
Know issues
- The autocompletion for rewritten object function doesn't work, the function will not appeaer in the selection menu. Howerver, once the function is written, the documentation window will appear correctly.