-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.js
More file actions
34 lines (29 loc) · 892 Bytes
/
tools.js
File metadata and controls
34 lines (29 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
define(function (require, exports, module) {
var React = require('react');
var _ = require('lodash');
// mounting a React component to a selector id location
var mount = function (component, location, argv) {
argv = argv || {};
if (!location) {
location = document.body;
} else {
location = document.getElementById(location);
}
if (!React.isValidElement(component)) {
component = React.createFactory(component);
}
React.render(component(argv), location);
};
// merging properties, used in React component for aggregating styles
var m = function () {
var res = {};
_.each(arguments, function (arg) {
return arg && _.merge(res, arg)
});
return res;
};
module.exports = {
mount: mount,
m: m
};
});