Socket
Socket
Sign inDemoInstall

linebreak

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linebreak - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

dist/main.cjs

40

package.json
{
"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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc