1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,64 @@ |
1 |
+"use strict"; |
|
2 |
+ |
|
3 |
+exports.__esModule = true; |
|
4 |
+exports.isObject = isObject; |
|
5 |
+exports.extend = extend; |
|
6 |
+exports.needsNavigation = needsNavigation; |
|
7 |
+exports.needsPagination = needsPagination; |
|
8 |
+exports.needsScrollbar = needsScrollbar; |
|
9 |
+exports.uniqueClasses = uniqueClasses; |
|
10 |
+ |
|
11 |
+function isObject(o) { |
|
12 |
+ return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object; |
|
13 |
+} |
|
14 |
+ |
|
15 |
+function extend(target, src) { |
|
16 |
+ Object.keys(src).forEach(function (key) { |
|
17 |
+ if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { |
|
18 |
+ extend(target[key], src[key]); |
|
19 |
+ } else { |
|
20 |
+ target[key] = src[key]; |
|
21 |
+ } |
|
22 |
+ }); |
|
23 |
+} |
|
24 |
+ |
|
25 |
+function needsNavigation(props) { |
|
26 |
+ if (props === void 0) { |
|
27 |
+ props = {}; |
|
28 |
+ } |
|
29 |
+ |
|
30 |
+ return props.navigation && typeof props.navigation.nextEl === 'undefined' && typeof props.navigation.prevEl === 'undefined'; |
|
31 |
+} |
|
32 |
+ |
|
33 |
+function needsPagination(props) { |
|
34 |
+ if (props === void 0) { |
|
35 |
+ props = {}; |
|
36 |
+ } |
|
37 |
+ |
|
38 |
+ return props.pagination && typeof props.pagination.el === 'undefined'; |
|
39 |
+} |
|
40 |
+ |
|
41 |
+function needsScrollbar(props) { |
|
42 |
+ if (props === void 0) { |
|
43 |
+ props = {}; |
|
44 |
+ } |
|
45 |
+ |
|
46 |
+ return props.scrollbar && typeof props.scrollbar.el === 'undefined'; |
|
47 |
+} |
|
48 |
+ |
|
49 |
+function uniqueClasses(classNames) { |
|
50 |
+ if (classNames === void 0) { |
|
51 |
+ classNames = ''; |
|
52 |
+ } |
|
53 |
+ |
|
54 |
+ var classes = classNames.split(' ').map(function (c) { |
|
55 |
+ return c.trim(); |
|
56 |
+ }).filter(function (c) { |
|
57 |
+ return !!c; |
|
58 |
+ }); |
|
59 |
+ var unique = []; |
|
60 |
+ classes.forEach(function (c) { |
|
61 |
+ if (unique.indexOf(c) < 0) unique.push(c); |
|
62 |
+ }); |
|
63 |
+ return unique.join(' '); |
|
64 |
+} |
|
0 | 65 |
\ No newline at end of file |