Comparing version
{ | ||
"name": "linebreak", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "An implementation of the Unicode Line Breaking Algorithm (UAX #14)", | ||
"source": "src/linebreaker.js", | ||
"type": "module", | ||
"main": "dist/main.cjs", | ||
"module": "dist/module.mjs", | ||
"exports": { | ||
"require": "./dist/main.cjs", | ||
"import": "./dist/module.mjs" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"repository": { | ||
@@ -22,17 +33,26 @@ "type": "git", | ||
"base64-js": "0.0.8", | ||
"brfs": "^2.0.2", | ||
"unicode-trie": "^1.0.0" | ||
"unicode-trie": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^6.0.2" | ||
"mocha": "^10.0.0", | ||
"parcel": "^2.5.0", | ||
"request": "^2.88.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "parcel build && mocha --reporter landing", | ||
"build": "parcel build", | ||
"prepublishOnly": "parcel build" | ||
}, | ||
"main": "src/linebreaker", | ||
"browserify": { | ||
"transform": [ | ||
"brfs" | ||
] | ||
"targets": { | ||
"main": { | ||
"includeNodeModules": [ | ||
"fs" | ||
] | ||
}, | ||
"module": { | ||
"includeNodeModules": [ | ||
"fs" | ||
] | ||
} | ||
} | ||
} |
@@ -5,12 +5,11 @@ # linebreak | ||
> Line breaking, also known as word wrapping, is the process of breaking a section of text into lines such that it will fit in the | ||
> available width of a page, window or other display area. The Unicode Line Breaking Algorithm performs part of this process. | ||
> Given an input text, it produces a set of positions called "break opportunities" that are appropriate points to begin a new line. | ||
> The selection of actual line break positions from the set of break opportunities is not covered by the Unicode Line Breaking Algorithm, | ||
> available width of a page, window or other display area. The Unicode Line Breaking Algorithm performs part of this process. | ||
> Given an input text, it produces a set of positions called "break opportunities" that are appropriate points to begin a new line. | ||
> The selection of actual line break positions from the set of break opportunities is not covered by the Unicode Line Breaking Algorithm, | ||
> but is in the domain of higher level software with knowledge of the available width and the display size of the text. | ||
This is a JavaScript implementation of the | ||
[Unicode Line Breaking Algorithm](http://www.unicode.org/reports/tr14/#SampleCode) for Node.js | ||
(and browsers I guess). It is used by [PDFKit](http://github.com/devongovett/pdfkit/) for | ||
line wrapping text in PDF documents, but since the algorithm knows nothing about the actual | ||
visual appearance or layout of text, it could be used for other things as well. | ||
This is a JavaScript implementation of the [Unicode Line Breaking Algorithm](http://www.unicode.org/reports/tr14/#SampleCode) for Node.js | ||
(and browsers I guess). Currently supports Unicode version 13. It is used by [PDFKit](http://github.com/devongovett/pdfkit/) for | ||
line wrapping text in PDF documents, but since the algorithm knows nothing about the actual visual appearance or layout of text, | ||
it could be used for other things as well. | ||
@@ -37,3 +36,3 @@ ## Installation | ||
console.log(word); | ||
// you can also check bk.required to see if this was a required break... | ||
@@ -43,3 +42,3 @@ if (bk.required) { | ||
} | ||
last = bk.position; | ||
@@ -54,9 +53,9 @@ } | ||
* The `src/classes.coffee` file is automatically generated from `LineBreak.txt` in the Unicode | ||
database by `src/generate_data.coffee`. It should be rare that you need to run this, but | ||
* The `src/classes.js` file is automatically generated from `LineBreak.txt` in the Unicode | ||
database by `src/generate_data.js`. It should be rare that you need to run this, but | ||
you may if, for instance, you want to change the Unicode version. | ||
* You can run the tests using `npm test`. They are written using `mocha`, and generated from | ||
`LineBreakTest.txt` from the Unicode database, which is included in the repository for performance | ||
reasons while running them. About 150 of the over 6000 tests are currently skipped due to | ||
reasons while running them. About 50 of the over 7600 tests are currently skipped due to | ||
implementation differences. It appears that some of the tests may be wrong or use different | ||
@@ -63,0 +62,0 @@ tailoring from the spec. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
2
-33.33%2755
916.61%2
-50%Yes
NaN218833
-75.62%3
200%7
-30%63
-1.56%1
Infinity%+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated