Simple, fast module for extracting strings of dynamic and optional class list.
Features:
- Support for string arguments.
- Supports Object syntax.
- Supports Function.
- Supports array of strings.
- Zero-dependency.
npm install dynamic-class-listThen require it in your module ...
var getClassNames = require('dynamic-class-list').getClassNames;import { getClassNames } from 'dynamic-class-list';// As Arguments getClassNames('class1', 'class2'); // Output : "class1 class2"// As an Array getClassNames(['class1', 'class2']); // Output : "class1 class2"Note that the key is used as the class if its value is truthy
// As an Object getClassNames({class1: true, class2 : false}); // Output : "class1"Note that the function should return a boolean
// Value as a function As an Object getClassNames({ class1: function() { return false; }, class2 : function() { return true; } }); // Output : "class2"// using all type of data getClassNames('class1', 'class2', ['class3', 'class4'], { class5 : function() { return false; }, class6 : function() { return true; } }); // Output : "class1 class2 class3 class4 class6"Markdown generated from README_js.md by 