mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
rename mergeOptions
This commit is contained in:
parent
8a3ff445ef
commit
6da18e9a85
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import { mergeOptionList } from '../../utils/general_utils';
|
||||
import { mergeOptions } from '../../utils/general_utils';
|
||||
|
||||
import EditionListStore from '../../stores/edition_list_store';
|
||||
import EditionListActions from '../../actions/edition_list_actions';
|
||||
@ -17,7 +17,7 @@ let PieceListBulkModal = React.createClass({
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptionList([EditionListStore.getState(), UserStore.getState()]);
|
||||
return mergeOptions(EditionListStore.getState(), UserStore.getState());
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import { mergeOptionList } from '../utils/general_utils';
|
||||
import { mergeOptions } from '../utils/general_utils';
|
||||
|
||||
import EditionActions from '../actions/edition_actions';
|
||||
import EditionStore from '../stores/edition_store';
|
||||
@ -14,7 +14,7 @@ import Edition from './edition';
|
||||
*/
|
||||
let EditionContainer = React.createClass({
|
||||
getInitialState() {
|
||||
return mergeOptionList([UserStore.getState(), EditionStore.getState()]);
|
||||
return mergeOptions(UserStore.getState(), EditionStore.getState());
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
|
@ -68,11 +68,11 @@ export function formatText() {
|
||||
* @param {[type]} l [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function mergeOptionList(l) {
|
||||
export function mergeOptions(...l) {
|
||||
let newObj = {};
|
||||
|
||||
for(let i = 1; i < l.length; i++) {
|
||||
newObj = mergeOptions(newObj, mergeOptions(l[i-1], l[i]));
|
||||
newObj = _mergeOptions(newObj, _mergeOptions(l[i-1], l[i]));
|
||||
}
|
||||
|
||||
return newObj;
|
||||
@ -85,7 +85,7 @@ export function mergeOptionList(l) {
|
||||
* @returns obj3 a new object based on obj1 and obj2
|
||||
* Taken from: http://stackoverflow.com/a/171256/1263876
|
||||
*/
|
||||
function mergeOptions(obj1,obj2){
|
||||
function _mergeOptions(obj1,obj2){
|
||||
var obj3 = {};
|
||||
for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
|
||||
for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
|
||||
|
Loading…
Reference in New Issue
Block a user