like-2-peas
v0.0.1
Published
This module is useful if you want an easy way to treat words/letters as elements on a web page.
Downloads
2
Readme
like-2-peas-in-a-div
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]