diff options
| author | Priyansh <[email protected]> | 2020-12-22 17:49:59 +0530 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2020-12-22 17:49:59 +0530 |
| commit | e93da8b04da86773247aadb1cbb1912e4f4526b2 (patch) | |
| tree | eb4ef3203a92ed3dbd2252ddb1ea23bd2d670c98 /node_modules/truncate-utf8-bytes/README.md | |
| parent | a5743c293dcb435e4b159a4df791f8955a4110ec (diff) | |
| download | styx-e93da8b04da86773247aadb1cbb1912e4f4526b2.tar.xz styx-e93da8b04da86773247aadb1cbb1912e4f4526b2.zip | |
Rewriting Project
Diffstat (limited to 'node_modules/truncate-utf8-bytes/README.md')
| -rw-r--r-- | node_modules/truncate-utf8-bytes/README.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/truncate-utf8-bytes/README.md b/node_modules/truncate-utf8-bytes/README.md new file mode 100644 index 0000000..098819e --- /dev/null +++ b/node_modules/truncate-utf8-bytes/README.md @@ -0,0 +1,27 @@ +# truncate-utf8-bytes [](http://travis-ci.org/parshap/truncate-utf8-bytes) + +Truncate a string to the given length in bytes. Correctly handles +multi-byte characters and surrogate pairs. + +A browser implementation that doesn't use `Buffer.byteLength` is +provided to minimize build size. + +## Example + +```js +var truncate = require("truncate-utf8-bytes") +var str = "a☃" // a = 1 byte, ☃ = 3 bytes +console.log(truncate(str, 2)) +// -> "a" +``` + +## API + +### `var truncate = require("truncate-utf8-bytes")` + +*When using browserify or webpack*, this automatically resolves to an +implementation that does not use `Buffer.byteLength`. + +### `truncate(string, length)` + +Returns `string` truncated to at most `length` bytes in length. |
