Skip to content

Commit

Permalink
Merge pull request #1 from cyrildever/develop
Browse files Browse the repository at this point in the history
change to ts-utls
  • Loading branch information
cyrildever authored Jul 24, 2020
2 parents 3abf4b2 + edb0f4f commit 97f4d38
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ts-utils
# ts-utls

### Utilities for TypeScript
### Utilities for TypeScript (in the browser)

Some functions I found useful, to borrow at your discretion:
Some functions I found useful when using TypeScript for browser apps, to borrow at your discretion:
* 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;
Expand All @@ -22,7 +22,7 @@ eg.
import {
chunk, flatten, groupBy, euclideanDivision, int2Buffer, stringBytes2Buffer,
capitalize, fromHex, hashCode, splitCamelCaseWords, toHex, xor
} from 'ts-utils'
} from 'ts-utls'

// For arrays

Expand Down Expand Up @@ -75,7 +75,7 @@ const xored = xor(a, b)
console.assert(xored === '\u0003')
```

Please let me know if you have more optimized implementations.
Please let me know if you have more optimized implementations of any of my stuff.


### License
Expand Down
2 changes: 1 addition & 1 deletion lib/src/typescript/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const int2Buffer = (uint: number): Buffer => {
* @throws not the string representation of bytes
*/
export const stringBytes2Buffer = (bits: string): Buffer => {
if (bits.length % 8 !== 0 || !bits.match(/^[01]+$/g)) {
if (bits.length % 8 !== 0 || !bits.match(/^[01]+$/g)) { // eslint-disable-line @typescript-eslint/strict-boolean-expressions
throw new Error('not the string representation of bytes')
}
const buf = Buffer.alloc(bits.length / 8)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 17 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ts-utils",
"name": "ts-utls",
"description": "Utilities for TypeScript library",
"version": "0.3.0",
"version": "1.0.0",
"main": "dist/lib/src/typescript/index.js",
"types": "dist/lib/src/typescript/index.d.ts",
"scripts": {
Expand All @@ -11,12 +11,24 @@
"fix-test": "eslint test --ext .ts --fix",
"test-on-windows": "tsc && browserify dist/test/typescript/index.spec.js -o dist/test/index.js && live-server --port=9001 --mount=/:test/typescript"
},
"license": "MIT",
"author": "Cyril Dever <cdever@edgewhere>",
"repository": {
"type": "git",
"url": "git+https://github.com/cyrildever/ts-utils.git"
"url": "git+https://github.com/cyrildever/ts-utls.git"
},
"keywords": [
"typescript",
"utils",
"string",
"array",
"number",
"bits"
],
"license": "MIT",
"author": "Cyril Dever <cdever@edgewhere>",
"bugs": {
"url": "https://github.com/cyrildever/ts-utls/issues"
},
"homepage": "https://github.com/cyrildever/ts-utls#readme",
"devDependencies": {
"@types/chai": "^4.2.11",
"@types/mocha": "^5.2.7",
Expand Down

0 comments on commit 97f4d38

Please sign in to comment.