1.0.0 • Published 8 years ago

unstructured-text-masher v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

unstructured-text-masher

Mashes an unstructured texst into another unstructured text allowing for subsequent mashing updates

Example

var mashedText = UnstructuredTextMasher.mash(
    'Unstructured text.',
    '<begin>',
    'Some generated text which may change in the future.',
    '<end (%fingerprint%)>');
console.log(mashedText);

outputs:

Unstructured text.<begin>Some generated text which may change in the future.<end (104f1998a99b8f46f037cf1200d03622b337e5fd)>

Then update the mashed text:

mashedText = UnstructuredTextMasher.mash(
    mashedText,
    '<begin>',
    'Updated generated text.',
    '<end (%fingerprint%)>');
console.log(mashedText);

outputs:

Unstructured text.<begin>Updated generated text.<end (6d7dffe0035f820feac7c71ca35eac0357f69670)>

Then insert more unstructured text and update the mashed text:

mashedText = 'Inserted unstructured text. ' + mashedText;
mashedText = UnstructuredTextMasher.mash(
    mashedText,
    '<begin>',
    'Updated generated text number 2.',
    '<end (%fingerprint%)>');
console.log(mashedText);

outputs:

Inserted unstructured text. Unstructured text.<begin>Updated generated text number 2.<end (5678d14cbdc1417992dfe18feabf0d6afc3a1f5f)>

Then append more unstructured text and update yet again the mashed text.

mashedText += ' Appended unstructured text.';
mashedText = UnstructuredTextMasher.mash(
    mashedText,
    '<begin>',
    'Updated generated text number 3.',
    '<end (%fingerprint%)>');
console.log(mashedText);

outputs:

Inserted unstructured text. Unstructured text.<begin>Updated generated text number 3.<end (7b33691ad5e7260abde676bf081551214be62616)> Appended unstructured text.