0.0.1 • Published 3 years ago

strr v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

strr

Building a class name dynamically for an element may look ugly. This module keeps your code clean.

Installation

npm install strr

Usage

var strr = require('strr');

var btnClassName = 'btn';

// Instead of doing this...
btnClassName = btnClassName + ' huge pressed';

// Do this.
btnClassName = strr.append(btnClassName, 'huge', 'pressed'); // btnClassName => 'btn huge pressed'

// Also, you can do this to add a string only when it is needed.
var menuClassName = strr.append('menu', strr.useIf('dark', useDarkTheme()));

// Or this if you frequently find yourself using append and useIf together.
// If the condition is true, the result is 'container masthead dark large'.
// If false, then it's 'container masthead'.
var containerClassName = strr.appendIf(['container', 'masthead'], ['dark', 'large'], useDarkTheme());
0.0.1

3 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago