mel-spintax

1.0.4 • Public • Published

mel-spintax

Parse Spintax formatted text (Nested Spintax supported)

Install

npm install mel-spintax

Example

var spintax = require('mel-spintax');

// Get unspinned text
console.log(spintax.unspin('{Hello|Hi} John!'));
// >>> "Hello John!" or "Hi John!"

// Get unspinned text from Nested Spintax
console.log(spintax.unspin('{Hello|Hi {there|again}} John!'));
// >>> "Hello John!" or "Hi there John!" or "Hi again John!"

// Count unique variations
console.log(spintax.count('{Hello|Hi {there|again}} John!'));
// >>> 3

// Validate format
console.log(spintax.validate('{Hello|Hi} John!'));
// >>> true
console.log(spintax.validate('{Hello|Hi John!'));
// >>> false

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    101
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    101
  • 1.0.3
    0
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i mel-spintax

Weekly Downloads

101

Version

1.0.4

License

MIT

Unpacked Size

6.07 kB

Total Files

5

Last publish

Collaborators

  • melnaron