aboutsummaryrefslogtreecommitdiff
path: root/node_modules/truncate-utf8-bytes
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2020-12-22 17:50:12 +0530
committerPriyansh <[email protected]>2020-12-22 17:50:12 +0530
commit22dc033f4938d6a19e086a1cbd36ec5cade5eaab (patch)
tree9feb963ccd5c1581e676e41004801abc67db3357 /node_modules/truncate-utf8-bytes
parente93da8b04da86773247aadb1cbb1912e4f4526b2 (diff)
downloadstyx-22dc033f4938d6a19e086a1cbd36ec5cade5eaab.tar.xz
styx-22dc033f4938d6a19e086a1cbd36ec5cade5eaab.zip
Remove node_modules
Diffstat (limited to 'node_modules/truncate-utf8-bytes')
-rw-r--r--node_modules/truncate-utf8-bytes/.gitmodules3
-rw-r--r--node_modules/truncate-utf8-bytes/.npmignore1
-rw-r--r--node_modules/truncate-utf8-bytes/.travis.yml12
-rw-r--r--node_modules/truncate-utf8-bytes/AUTHORS2
-rw-r--r--node_modules/truncate-utf8-bytes/README.md27
-rw-r--r--node_modules/truncate-utf8-bytes/browser.js5
-rw-r--r--node_modules/truncate-utf8-bytes/index.js5
-rw-r--r--node_modules/truncate-utf8-bytes/lib/truncate.js43
-rw-r--r--node_modules/truncate-utf8-bytes/package.json68
-rw-r--r--node_modules/truncate-utf8-bytes/test.js75
10 files changed, 0 insertions, 241 deletions
diff --git a/node_modules/truncate-utf8-bytes/.gitmodules b/node_modules/truncate-utf8-bytes/.gitmodules
deleted file mode 100644
index d496220..0000000
--- a/node_modules/truncate-utf8-bytes/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "vendor/big-list-of-naughty-strings"]
- path = vendor/big-list-of-naughty-strings
- url = https://github.com/minimaxir/big-list-of-naughty-strings.git
diff --git a/node_modules/truncate-utf8-bytes/.npmignore b/node_modules/truncate-utf8-bytes/.npmignore
deleted file mode 100644
index 48b8bf9..0000000
--- a/node_modules/truncate-utf8-bytes/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-vendor/
diff --git a/node_modules/truncate-utf8-bytes/.travis.yml b/node_modules/truncate-utf8-bytes/.travis.yml
deleted file mode 100644
index 1e25a8c..0000000
--- a/node_modules/truncate-utf8-bytes/.travis.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-language: node_js
-node_js:
- - "0.10"
- - "0.12"
- - "1"
- - "2"
- - "3"
- - "4"
- - "5"
- - "node"
-before_install:
- - npm install -g npm
diff --git a/node_modules/truncate-utf8-bytes/AUTHORS b/node_modules/truncate-utf8-bytes/AUTHORS
deleted file mode 100644
index 6212900..0000000
--- a/node_modules/truncate-utf8-bytes/AUTHORS
+++ /dev/null
@@ -1,2 +0,0 @@
-Carl Xiong <[email protected]>
-Parsha Pourkhomami <[email protected]>
diff --git a/node_modules/truncate-utf8-bytes/README.md b/node_modules/truncate-utf8-bytes/README.md
deleted file mode 100644
index 098819e..0000000
--- a/node_modules/truncate-utf8-bytes/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# truncate-utf8-bytes [![build status](https://secure.travis-ci.org/parshap/truncate-utf8-bytes.svg?branch=master)](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.
diff --git a/node_modules/truncate-utf8-bytes/browser.js b/node_modules/truncate-utf8-bytes/browser.js
deleted file mode 100644
index f0cfe50..0000000
--- a/node_modules/truncate-utf8-bytes/browser.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-var truncate = require("./lib/truncate");
-var getLength = require("utf8-byte-length/browser");
-module.exports = truncate.bind(null, getLength);
diff --git a/node_modules/truncate-utf8-bytes/index.js b/node_modules/truncate-utf8-bytes/index.js
deleted file mode 100644
index 39e899c..0000000
--- a/node_modules/truncate-utf8-bytes/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-var truncate = require("./lib/truncate");
-var getLength = Buffer.byteLength.bind(Buffer);
-module.exports = truncate.bind(null, getLength);
diff --git a/node_modules/truncate-utf8-bytes/lib/truncate.js b/node_modules/truncate-utf8-bytes/lib/truncate.js
deleted file mode 100644
index 3fed3b6..0000000
--- a/node_modules/truncate-utf8-bytes/lib/truncate.js
+++ /dev/null
@@ -1,43 +0,0 @@
-'use strict';
-
-function isHighSurrogate(codePoint) {
- return codePoint >= 0xd800 && codePoint <= 0xdbff;
-}
-
-function isLowSurrogate(codePoint) {
- return codePoint >= 0xdc00 && codePoint <= 0xdfff;
-}
-
-// Truncate string by size in bytes
-module.exports = function truncate(getLength, string, byteLength) {
- if (typeof string !== "string") {
- throw new Error("Input must be string");
- }
-
- var charLength = string.length;
- var curByteLength = 0;
- var codePoint;
- var segment;
-
- for (var i = 0; i < charLength; i += 1) {
- codePoint = string.charCodeAt(i);
- segment = string[i];
-
- if (isHighSurrogate(codePoint) && isLowSurrogate(string.charCodeAt(i + 1))) {
- i += 1;
- segment += string[i];
- }
-
- curByteLength += getLength(segment);
-
- if (curByteLength === byteLength) {
- return string.slice(0, i + 1);
- }
- else if (curByteLength > byteLength) {
- return string.slice(0, i - segment.length + 1);
- }
- }
-
- return string;
-};
-
diff --git a/node_modules/truncate-utf8-bytes/package.json b/node_modules/truncate-utf8-bytes/package.json
deleted file mode 100644
index b42e054..0000000
--- a/node_modules/truncate-utf8-bytes/package.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- "_from": "truncate-utf8-bytes@^1.0.0",
- "_id": "[email protected]",
- "_inBundle": false,
- "_integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=",
- "_location": "/truncate-utf8-bytes",
- "_phantomChildren": {},
- "_requested": {
- "type": "range",
- "registry": true,
- "raw": "truncate-utf8-bytes@^1.0.0",
- "name": "truncate-utf8-bytes",
- "escapedName": "truncate-utf8-bytes",
- "rawSpec": "^1.0.0",
- "saveSpec": null,
- "fetchSpec": "^1.0.0"
- },
- "_requiredBy": [
- "/sanitize-filename"
- ],
- "_resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",
- "_shasum": "405923909592d56f78a5818434b0b78489ca5f2b",
- "_spec": "truncate-utf8-bytes@^1.0.0",
- "_where": "/Users/lucifer/Documents/styx/node_modules/sanitize-filename",
- "author": {
- "name": "Carl Xiong",
- "email": "[email protected]"
- },
- "browser": "browser.js",
- "bugs": {
- "url": "https://github.com/parshap/truncate-utf8-bytes/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Carl Xiong",
- "email": "[email protected]"
- },
- {
- "name": "Parsha Pourkhomami",
- "email": "[email protected]"
- }
- ],
- "dependencies": {
- "utf8-byte-length": "^1.0.1"
- },
- "deprecated": false,
- "description": "Truncate string to given length in bytes",
- "devDependencies": {
- "tape": "^4.2.2"
- },
- "homepage": "https://github.com/parshap/truncate-utf8-bytes#readme",
- "keywords": [
- "truncate",
- "utf8"
- ],
- "license": "WTFPL",
- "main": "index.js",
- "name": "truncate-utf8-bytes",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/parshap/truncate-utf8-bytes.git"
- },
- "scripts": {
- "test": "tape test.js"
- },
- "version": "1.0.2"
-}
diff --git a/node_modules/truncate-utf8-bytes/test.js b/node_modules/truncate-utf8-bytes/test.js
deleted file mode 100644
index bde24f4..0000000
--- a/node_modules/truncate-utf8-bytes/test.js
+++ /dev/null
@@ -1,75 +0,0 @@
-"use strict";
-
-var test = require("tape");
-var truncate = require("./");
-var browserTruncate = require("./browser");
-
-function isHighSurrogate(codePoint) {
- return codePoint >= 0xd800 && codePoint <= 0xdbff;
-}
-
-function repeat(string, times) {
- return new Array(times + 1).join(string);
-}
-
-function assertLengths(t, string, charLength, byteLength) {
- t.equal(string.length, charLength);
- t.equal(Buffer.byteLength(string), byteLength);
-}
-
-// Test writing files to the fs
-//
-
-try {
- var blns = require("./vendor/big-list-of-naughty-strings/blns.json");
-}
-catch (err) {
- console.error("Error: Cannot load file './vendor/big-list-of-naughty-strings/blns.json'");
- console.error();
- console.error("Make sure you've initialized git submodules by running");
- console.error();
- console.error(" git submodule update --init");
- console.error();
- process.exit(1);
-}
-
-// Run tests against both implementations
-[truncate, browserTruncate].forEach(function(truncate) {
- test("strings", function(t) {
- assertLengths(t, truncate("a☃", 2), 1, 1);
- assertLengths(t, truncate(repeat("a", 250) + '\uD800\uDC00', 255), 252, 254);
- assertLengths(t, truncate(repeat("a", 251) + '\uD800\uDC00', 255), 253, 255);
- assertLengths(t, truncate(repeat("a", 252) + '\uD800\uDC00', 255), 252, 252);
- assertLengths(t, truncate(repeat("a", 253) + '\uD800\uDC00', 255), 253, 253);
- assertLengths(t, truncate(repeat("a", 254) + '\uD800\uDC00', 255), 254, 254);
- assertLengths(t, truncate(repeat("a", 255) + '\uD800\uDC00', 255), 255, 255);
- t.end();
- });
-
- // Truncate various strings
- [].concat(
- [
- repeat("a", 300),
- repeat("a", 252) + '\uD800\uDC00',
- repeat("a", 251) + '\uD800\uDC00',
- repeat("a", 253) + '\uD800\uDC00',
- ],
- blns
- ).forEach(function(str) {
- test(JSON.stringify(str), function(t) {
- var i = 0;
- t.equals(truncate(str, 0), "");
- // Truncate string one byte at a time
- while (true) {
- var truncated = truncate(str, i);
- t.ok(Buffer.byteLength(truncated) <= i);
- t.ok( ! isHighSurrogate(truncated[truncated.length - 1]));
- if (truncated === str) {
- break;
- }
- i += 1;
- }
- t.end();
- });
- });
-});