w0rp / typescript-algorithms

Public domain TypeScript algorithms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript Algorithms

Travis CI Build Status

This repository hosts some TypeScript algorithms which are licensed under the Unlicense, and therefore released into the public domain. This repository showcases how to write useful code in TypeScript, and the code can be used freely by anyone for any reason.

The NPM package has no dependences other than devDependences, and the code is designed to work in any ECMAScript 2015 environment with a recent stable TypeScript compiler.

Algorithms

Code for all of the algorithms below can be viewed by clicking on them, and tests showing examples of how to use them can be viewed by clicking the wrenches.

notNull

notNull(x, message?) 🔧

Return x, but throw if x is null or undefined.

An optional message can be provided for showing if x turns out to be null or undefined.

orderBy

orderBy(cb) 🔧

Create a comparison function for sorting Arrays by particular keys.

pick

pick(obj, ...keys) 🔧

Pick a subset of keys from an object.

uniq

uniq(array, cmp) 🔧

Create an Array with repeated elements removed.

Running tests

To run all of the tests on Unix, run ./run-tests, and hopefully everything should go well. You will need to have yarn installed on your system. You should see the results in your browser.

About

Public domain TypeScript algorithms

License:The Unlicense


Languages

Language:TypeScript 43.5%Language:JavaScript 42.7%Language:Shell 13.8%