@saulx/utils
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -11,2 +11,3 @@ import deepCopy from './deepCopy'; | ||
export { deepCopy, queued, readStream, isObject, wait, deepEqual, toEnvVar, retry, randomString, }; | ||
export * from './encoder'; | ||
export * from './deepMerge'; | ||
@@ -13,0 +14,0 @@ export * from './walker'; |
@@ -27,2 +27,3 @@ "use strict"; | ||
exports.randomString = randomString_1.default; | ||
__export(require("./encoder")); | ||
__export(require("./deepMerge")); | ||
@@ -29,0 +30,0 @@ __export(require("./walker")); |
{ | ||
"name": "@saulx/utils", | ||
"main": "./dist/index.js", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "build": "tsc", |
@@ -137,3 +137,3 @@ # utils | ||
const x = toEnvVar('@based/bla-bla-bla$_!') | ||
console.log(x) // prints BASED_BLA_BLA_BLA | ||
console.log(x) // BASED_BLA_BLA_BLA | ||
``` | ||
@@ -151,3 +151,3 @@ | ||
## uft8ToString | ||
## utf8ToString | ||
@@ -179,3 +179,3 @@ Convert a utf8 Uint8 array to a string | ||
Decoded a base64 string to a utf-8 Uint8 array | ||
Decode a base64 string to a utf-8 Uint8 array | ||
(vs atob where its not supported) | ||
@@ -189,2 +189,21 @@ | ||
## createEncoder | ||
Create an encoder similair to `encodeUri` / `decodeUri` but with specific strings | ||
Will use `[a-z]` and `[0-9]` as encoded variables | ||
```javascript | ||
import { createEncoder } from '@saulx/utils' | ||
const { encode, decode } = createEncoder(['🥹'], '@') | ||
console.log(encode('hello 🥹')) // "hello @a" | ||
``` | ||
Can be used with larger strings | ||
```javascript | ||
import { createEncoder } from '@saulx/utils' | ||
const { encode, decode } = createEncoder(['hello'], '@') | ||
console.log(encode('hello 🥹')) // "@a 🥹" | ||
``` | ||
## queued | ||
@@ -191,0 +210,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82679
55
1198
303