2022-02-11 11:38:31 +01:00
# Micro Functional Programming tools by JavaScript
2022-02-04 07:31:49 +01:00
2022-02-05 18:14:35 +01:00
Simple functional functions common to any development in Typescript or JavaScript.
2022-02-10 09:53:37 +01:00
## Example
```javascript
import {getRandom, range} from 'fnTools.js';
getRandom(0, 6);
// 2
range(4);
// [0, 1, 2, 3, 4]
```
2022-02-11 11:37:52 +01:00
## Install
2022-02-10 09:53:37 +01:00
2022-02-11 11:37:52 +01:00
```shell
npm install micro-fp-tools
2022-02-10 09:53:37 +01:00
```
## Documentation
### Number
2022-02-10 09:25:11 +01:00
2022-02-05 18:14:35 +01:00
- **inc**: Increase the value of a `number` .
- **dec**: Decrease the value of a `number` .
2022-02-10 09:25:11 +01:00
- **getRandom**: Returns a random number from a range, with an optional number of decimal places.
2022-02-10 09:53:37 +01:00
### Array
2022-02-10 09:29:55 +01:00
2022-02-05 18:14:35 +01:00
- **range**: Returns an array with a sequence.
- **uniqValuesArray**: Creates a duplicate-free version of an array.
2022-02-10 09:25:11 +01:00
- **deleteArrayElementByIndex**: Returns a copy of the array by removing one position by index.
2022-02-10 09:29:55 +01:00
- **arraySwapIndex**: Returns a copy of the Array by swapping 2 indices.
2022-02-10 09:25:11 +01:00
2022-02-10 09:53:37 +01:00
### JSON
2022-02-10 09:25:11 +01:00
2022-02-05 18:14:35 +01:00
- **cloneJSON**: Clone JSON.
- **updateJSON**: Returns a JSON with an updated value.
2022-02-10 09:25:11 +01:00
2022-02-10 09:53:37 +01:00
### File
2022-02-10 09:25:11 +01:00
2022-02-09 16:57:53 +01:00
- **getIndexOfFileList**: Returns the index of an Array of Files from its name. If there are multiple files with the same name, the last one will be returned.
2022-02-10 09:25:11 +01:00
- **arrayFilesToFileList**: Returns a FileLists from an array containing Files.
2022-02-10 09:39:22 +01:00
- **encodeFileToText**: Returns a File in text.
2022-02-10 09:53:37 +01:00
- **getUniqFiles**: Returns an Array from the union of 2 Arrays of Files avoiding repetitions.
2022-02-06 22:26:49 +01:00
2022-02-05 18:14:35 +01:00
## Compile
Install Typescript
2022-02-04 07:31:49 +01:00
```shell
2022-02-05 18:14:35 +01:00
npm install -g typescript
```
And build.
```shell
make build
````
2022-02-09 16:57:53 +01:00
Check 'dist' folder.