Simple functional functions common to any development in Typescript or JavaScript.
Go to file
2022-02-10 09:25:11 +01:00
dist Add random 2022-02-06 22:26:49 +01:00
src Update fnTools.ts 2022-02-10 09:22:58 +01:00
Makefile Update format 2022-02-05 18:14:35 +01:00
README.md Update README.md 2022-02-10 09:25:11 +01:00

fnTools

Simple functional functions common to any development in Typescript or JavaScript.

Number

  • inc: Increase the value of a number.
  • dec: Decrease the value of a number.
  • getRandom: Returns a random number from a range, with an optional number of decimal places.

Array

  • range: Returns an array with a sequence.
  • uniqValuesArray: Creates a duplicate-free version of an array.
  • deleteArrayElementByIndex: Returns a copy of the array by removing one position by index.

JSON

  • cloneJSON: Clone JSON.
  • updateJSON: Returns a JSON with an updated value.

File

  • 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.
  • arrayFilesToFileList: Returns a FileLists from an array containing Files.

Example

import {getRandom, range} from 'fnTools.js';

getRandom(0, 6);
// 2

range(4);
// [0, 1, 2, 3, 4]

CDN

<script type="module" src="https://cdn.jsdelivr.net/gh/tanrax/fn-js/dist/fnTools.min.js"></script>

Compile

Install Typescript

npm install -g typescript

And build.

make build

Check 'dist' folder.