根据Google表格中的单元格值将列移动到另一个表格

时间:2019-02-13 23:20:18

标签: google-apps-script google-sheets cell multiple-columns move

我正在根据给定行中的单元格值将一列移至另一张纸。我能够对行执行此操作,但对列不行。

import { Subject, Observable, BehaviorSubject, of } from 'rxjs';

interface SelectorMap {
  [key: string]: Function;
}

interface SubjectMap {
  [key: string]: Subject<any>;
}

const mockedValueShowMailingAddress = true;

const storeSubjectMock = new 
BehaviorSubject(mockedValueShowMailingAddress);

export class MockStore {
  public selectStreams: SubjectMap = {};

  constructor(private selectors: SelectorMap) {}

  public pipe() {
    return storeSubjectMock.asObservable();
  }

  public reset() {
    Object.values(this.selectStreams).map(subject => 
subject.complete());
    this.selectStreams = {};
    this.selectors = {};
  }

  public dispatch(obj) {}

  public select(selector): Observable<any> {
    const selectKey = getKeyByValue(this.selectors, selector);
    if (!this.selectStreams[selectKey]) {
      this.selectStreams[selectKey] = new Subject();
    }
    return this.selectStreams[selectKey];
  }
}

function getKeyByValue(object, value) {
  return Object.keys(object).find(key => object[key] === value);
}

0 个答案:

没有答案