Coder Social home page Coder Social logo

js-lib's Introduction

Typescript utils for js/ts

General lib to make your life easier based on typescript

NPM NPM

Installation

npm i mmzaghlool

Importing

ES5

const MMZaghlool = require("mmzaghlool");
const { sortingTypes } = require("mmzaghlool");

ES6

import MMZaghlool, { sortingTypes } from "mmzaghlool";
  1. Recursion Sum
  2. Sorting

Recursion Sum

Get the sum of array of numbers based on recursion algorithm it takes an array of numbers and return single number "Sum"

const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];

MMZaghlool.Math.recursionSum(arr);

Sorting

Section Sort

Sort array of numbers or objects ascending or descending using selection sort algorithm

It takes an array of numbers or objects and return the sorted array

// Sort array of numbers
const arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9];

MMZaghlool.Math.sectionSort(arr1, sortingTypes.DESCENDING)

// Sort array of objects based on "id" attribute
const arr2 = [{ id: 5 }, { id: 7 }, { id: 3 }, { id: 2 }, { id: 9 }];
MMZaghlool.Math.sectionSort(arr2, sortingTypes.ASCENDING, "id")

Quick Sort

Sort array of numbers or objects ascending or descending using quick sort algorithm

It takes an array of numbers or objects and return the sorted array

// Sort array of numbers
const arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9];

MMZaghlool.Math.quickSort(arr1, sortingTypes.DESCENDING)

// Sort array of objects based on "id" attribute
const arr2 = [{ id: 5 }, { id: 7 }, { id: 3 }, { id: 2 }, { id: 9 }];
MMZaghlool.Math.quickSort(arr2, sortingTypes.ASCENDING, "id")

Reach Me

If you need any help or any suggestions feel free to contact me anytime

LinkedIn profile Gmai account

js-lib's People

Contributors

mmzaghlool avatar

Stargazers

Roman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.