Skip to content

nickreese/mel-spintax

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Parse Spintax formatted text (Nested Spintax supported)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%