Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
This is a JavaScript implementation of Franklin M. Liang's hyphenation algorithm. It relies on fast programming techniques to reduce execution time. The accuracy of hyphenation results depend on the quality of predefined patterns collections, that are different for every language. This implementation uses patterns collections from the TeX website, http://www.ctan.org/.
var hyphenate = createHyphenator(hyphenationPatternsEnGb);
var initialText = "A certain king had a beautiful garden"
var hyphenatedText = hyphenate(initialText);
// A cer-tain king had a beau-ti-ful garden
###Demo JSFiddle
###Algorithm description PDF Document
###Install
npm install hyphen
or
bower install hyphe
###Configuration
There are a couple of settings you can use to configure hyphenator function:
\u00AD
character to something else, use hyphenChar: "-"
var hyphenate = createHyphenator(hyphenationPatternsEnGb, {hyphenChar:'-'})
debug: true
var hyphenate = createHyphenator(hyphenationPatternsEnGb, {debug:true})
###Supported languages
###Hyphenation in CSS
The CSS hyphens
property is intended to add hyphenation support to modern browsers without Javascript:
p {
hyphens: auto;
}
It is part of the CSS Text Level 3 specification. The browser compatibility list can be found on the related MDN page.
###Alternatives Check out other well-known Javascript hyphenation algorithm implementations:
###License MIT
FAQs
Text hyphenation in Javascript.
The npm package hyphen receives a total of 522,178 weekly downloads. As such, hyphen popularity was classified as popular.
We found that hyphen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.