Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81152 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule joinClasses
10
* @typechecks static-only
11
*/
12
13
"use strict";
14
15
/**
16
* Combines multiple className strings into one.
17
* http://jsperf.com/joinclasses-args-vs-array
18
*
19
* @param {...?string} classes
20
* @return {string}
21
*/
22
function joinClasses(className/*, ... */) {
23
if (!className) {
24
className = '';
25
}
26
var nextClass;
27
var argLength = arguments.length;
28
if (argLength > 1) {
29
for (var ii = 1; ii < argLength; ii++) {
30
nextClass = arguments[ii];
31
if (nextClass) {
32
className = (className ? className + ' ' : '') + nextClass;
33
}
34
}
35
}
36
return className;
37
}
38
39
module.exports = joinClasses;
40
41