like-2-peas

This module is useful if you want an easy way to treat words/letters as elements on a web page.

Usage no npm install needed!

<script type="module">
  import like2Peas from 'https://cdn.skypack.dev/like-2-peas';
</script>

README

like-2-peas-in-a-div Build Status

This module is useful if you want an easy way to treat words/letters as elements on a web page.

Install

$ npm install --save like-2-peas

Usage

var like2Peas = require('like-2-peas');
var plant = document.createElement('div');

like2Peas('One Two', plant );
console.log(plant.innerHTML);
/*
'
<div class="pod" pod-id="0">
  <p class="pea" pea-id="0">
    O
  </p>
  <p class="pea" pea-id="1">
    n
  </p>
  <p class="pea" pea-id="2">
    e
  </p>
</div>
<div class="pod" pod-id="1">
  <p class="pea" pea-id="0">
    T
  </p>
  <p class="pea" pea-id="1">
    w
  </p>
  <p class="pea" pea-id="2">
    o
  </p>
</div>
'
*/

API

like2Peas(text, target)

text

Type: string

Make sure to note that spaces are not returned as page elements. Style the margins of the .pea and .pod classes to add space as you see fit.

target

Type: htmlDivElement

like-two-peas appends the .pod divs to the provide target.

License

MIT © [Christopher Howard]