Skip to content

Commit

Permalink
shields and auto-review
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrildever committed Jul 24, 2020
1 parent 97f4d38 commit 7516d64
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
# ts-utls

### Utilities for TypeScript (in the browser)
![Github tag (latest by date)](https://img.shields.io/github/v/tag/cyrildever/ts-utls)
![npm](https://img.shields.io/npm/dw/ts-utls)
![Github last commit](https://img.shields.io/github/last-commit/cyrildever/ts-utls)
![Github issues](https://img.shields.io/github/issues/cyrildever/ts-utls)
![NPM](https://img.shields.io/npm/l/ts-utls)

Some functions I found useful when using TypeScript for browser apps, to borrow at your discretion:
ts-utls is a small TypeScript library where I put all useful stuff I regularly need in my projects.
Feel free to use at your discretion.


### Usage

```console
npm i ts-utls
```

This library contains the following functions:
* For arrays:
* `chunk`: split an array into chunks of a maximum size;
* `flatten`: transform an array of arrays of items to an array of items;
* `groupBy`: group an array of items by some item's field;
* For numbers:
* `euclideanDivision`: computes the euclidean division of two integers, returning the quotient and the remainder;
* `int2Buffer`: converts an integer to its byte array equivalent;
* `stringBytes2Buffer`: transforms a string representing one or more bytes to a byte array;
* For numbers and bits:
* `euclideanDivision`: compute the euclidean division of two integers, returning the quotient and the remainder;
* `int2Buffer`: convert an integer to its byte array equivalent;
* `stringBytes2Buffer`: transform a string representing one or more bytes to a byte array;
* For strings:
* `capitalize`: capitalize the first letter of a sentence;
* `fromHex` and `toHex`: transform hexadecimal string representation to byte array, and vice-versa;
* `hashCode`: computes the equivalent of Java's hashCode;
* `splitCamelCaseWords`: put a space between each "word" found in a camel-case string.
* `hashCode`: compute the equivalent of Java's hashCode;
* `splitCamelCaseWords`: put a space between each "word" found in a camel-case string;
* `xor`: apply the XOR logical function to two strings in the sense that each charCode is xored.

eg.
```typescript
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
"string",
"array",
"number",
"bits"
"bits",
"flatten",
"groupBy",
"hashCode",
"euclidean division",
"xor"
],
"license": "MIT",
"author": "Cyril Dever <cdever@edgewhere>",
Expand Down

0 comments on commit 7516d64

Please sign in to comment.