1.0.0 • Published 8 years ago
softbreak v1.0.0
Softbreak
Installation
npm install softbreak --save-devUsage
const config: Config = {
insertCharacter: 'A',
wordRules: [endRule, startRule],
rules: [midRule]
};
softbreak(config, 'alongwordhere');
softbreak([endRule, startRule], 'alongwordhere');
softbreak('alongwordhere');rules and wordRules implement the same Rule which takes a single string, and returns a set of indicies where characters should be inserted.
rules receive the whole text, where-as wordRules receives a single word at the time. Indices from wordRules are automatically adjusted by the words original position. So all rules are interchangable between the two.
Types
Full documentation of types can be seen here, or here if you prefer reading typescript code.
Tips
- Take a look at the original readme;
Credits
Made using the awesome typescript library starter
1.0.0
8 years ago