Str[ing] [st]yle
Revision for 1.0.4
- Brief Introduction
- Installation
- Exemplar
- Legal (MIT license)
A JavaScript package for ease of manipulating strings, with CSS styling for each character and basic methods.
Install Node.js if not already.
Verify npm installation with npm -v
, which should return the installed version. If not refer to prior step.
To install the stryle package, use the command npm install stryle
For each of the following examples the code snippet below is required to satisfy the importing of the modules, and initialization of the stryle class.
var Stryle = require('stryle');
var range = require('stryle/src/range');
string = new Stryle('Hello, World!');
console.log(
string.export()
);
Hello, World!
string.import(
string.slice(
0, 6
) + 'Stryle!'
);
console.log(
string.export()
);
Hello, Stryle!
console.log(
string.length()
);
13
string.replace(12, ';');
console.log(
string.export();
);
Hello, World;
console.log(
string.slice(7, 12)
);
World
string.style(
'font-size: 10px;',
[12, 0, 1, 2, 3, 4]
);
console.log(
string.export()
);
<span style="font-size: 10px;">He</span>llo</span>, World<span style="font-size: 10px;">!</span>
string.unstyle(
'font-size: 10px;'
);
console.log(
string.export()
);
Hello, World!
console.log(
range(5, 10)
);
[ 5, 6, 7, 8, 9, 10 ]
string.color(
'blue',
range(0, 4)
);
console.log(
string.export()
);
<span style="color:blue;">Hello</span>, World!
string.uncolor(
'blue'
);
console.log(
string.export()
);
Hello, World!
Permissions | Conditions | Limitations |
---|---|---|
Commercial use | License and copyright notice | Liability |
Distribution | Warranty | |
Modification | ||
Private use |
MIT License
Copyright (c) 2022 Ivan (GitHub: ivanl-exe, E-Mail: ivan.exe@pm.me)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.