當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.isEqual函數代碼示例

本文整理匯總了TypeScript中lodash.isEqual函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isEqual函數的具體用法?TypeScript isEqual怎麽用?TypeScript isEqual使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了isEqual函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: processImage

 private processImage(key, value, options) {
   if (_.isEqual(key, 'icon') || _.isEqual(key, 'image') || _.endsWith(key, 'Icon') || _.endsWith(key, 'Image')) {
     options[key] = resolveAssetSource(value);
   }
 }
開發者ID:Fiv38,項目名稱:react-native-navigation,代碼行數:5,代碼來源:OptionsProcessor.ts

示例2: equalVariablesOf

 /**
  * Compares current variables with previous ones.
  *
  * @param  {string}  queryName  Query's name
  * @param  {any}     variables  current variables
  * @return {boolean}            comparasion result
  */
 function equalVariablesOf(queryName: string, variables: any): boolean {
   return isEqual(lastQueryVariables[queryName], variables);
 }
開發者ID:hlehmann,項目名稱:angular2-apollo,代碼行數:10,代碼來源:apolloDecorator.ts

示例3:

 initiallySelectedSubtotalRows.forEach((sp)=> {
     if (_.isEqual(node.sectorPath(), sp))
         node.toggleSelect(true);
 });
開發者ID:ankitaparekh,項目名稱:GigaGrid,代碼行數:4,代碼來源:TreeBuilder.ts

示例4: return

 return (p: FixtureStateProps) => isEqual(p.elementId, elementId);
開發者ID:skidding,項目名稱:cosmos,代碼行數:1,代碼來源:props.ts

示例5: equalVariablesOf

 /**
  * Compares current variables with previous ones.
  *
  * @param  {string}  queryName  Query's name
  * @param  {any}     variables  current variables
  * @return {boolean}            comparasion result
  */
 function equalVariablesOf(queryName: string, variables: any): boolean {
   return lastQueryVariables.hasOwnProperty(queryName) && isEqual(lastQueryVariables[queryName], variables);
 }
開發者ID:jboothe,項目名稱:angular2-apollo,代碼行數:10,代碼來源:apolloDecorator.ts

示例6: stateMonitor

function stateMonitor(state: State, customInitialState: State) {
  let destroyed = false;
  let ignoredProps: string[] = [];
  let changeHandlers: ChangeHandlerFn[] | undefined = [];
  let initialState: State;

  setInitialState(customInitialState);

  function setInitialState(innerCustomInitialState: State) {
    // state.toJSON returns a reference, clone so we can mutate it safely
    initialState = cloneDeep(innerCustomInitialState) || cloneDeep(state.toJSON());
  }

  function removeIgnoredProps(innerState: State) {
    ignoredProps.forEach(path => {
      set(innerState, path, true);
    });
    return innerState;
  }

  function getStatus(): StateStatus {
    // state.toJSON returns a reference, clone so we can mutate it safely
    const currentState = removeIgnoredProps(cloneDeep(state.toJSON()));
    const isClean = isEqual(currentState, initialState);

    return {
      clean: isClean,
      dirty: !isClean,
    };
  }

  function dispatchChange(type: string | null = null, keys: string[] = []) {
    const status = getStatus();
    if (!changeHandlers) {
      throw new Error('Change handlers is undefined, this object has been destroyed');
    }
    changeHandlers.forEach(changeHandler => {
      changeHandler(status, type, keys);
    });
  }

  function dispatchFetch(keys: string[]) {
    dispatchChange('fetch_with_changes', keys);
  }

  function dispatchSave(keys: string[]) {
    dispatchChange('save_with_changes', keys);
  }

  function dispatchReset(keys: string[]) {
    dispatchChange('reset_with_changes', keys);
  }

  return {
    setInitialState(innerCustomInitialState: State) {
      if (!isPlainObject(innerCustomInitialState)) {
        throw new TypeError('The default state must be an object');
      }

      // check the current status
      const previousStatus = getStatus();

      // update the initialState and apply ignoredProps
      setInitialState(innerCustomInitialState);
      removeIgnoredProps(initialState);

      // fire the change handler if the status has changed
      if (!isEqual(previousStatus, getStatus())) {
        dispatchChange();
      }
    },

    ignoreProps(props: string[]) {
      ignoredProps = ignoredProps.concat(props);
      removeIgnoredProps(initialState);
      return this;
    },

    onChange(callback: ChangeHandlerFn) {
      if (destroyed || !changeHandlers) {
        throw new Error('Monitor has been destroyed');
      }
      if (typeof callback !== 'function') {
        throw new Error('onChange handler must be a function');
      }

      changeHandlers.push(callback);

      // Listen for state events.
      state.on('fetch_with_changes', dispatchFetch);
      state.on('save_with_changes', dispatchSave);
      state.on('reset_with_changes', dispatchReset);

      // if the state is already dirty, fire the change handler immediately
      const status = getStatus();
      if (status.dirty) {
        dispatchChange();
      }

      return this;
//.........這裏部分代碼省略.........
開發者ID:elastic,項目名稱:kibana,代碼行數:101,代碼來源:state_monitor_factory.ts

示例7:

 scope.$watch(prop, (next, prev) => {
   if (isUndefined(next) || isEqual(next, prev)) {
     return;
   }
   scope.setAppData(keyPath, next);
 });
開發者ID:domelaz,項目名稱:IML_CutLayout,代碼行數:6,代碼來源:immutable.ts

示例8: isEqual

 return allowBoolOrArray.some(item => isEqual(item, path))
開發者ID:patrickhulce,項目名稱:klay,代碼行數:1,代碼來源:transform-model.ts

示例9: processColor

 private processColor(key: string, value: any, options: Record<string, any>) {
   if (_.isEqual(key, 'color') || _.endsWith(key, 'Color')) {
     options[key] = this.colorService.toNativeColor(value);
   }
 }
開發者ID:wix,項目名稱:react-native-navigation,代碼行數:5,代碼來源:OptionsProcessor.ts

示例10: isEqual

 return keysA.every(key => isEqual(a[key], b[key]));
開發者ID:flopma,項目名稱:sonarqube,代碼行數:1,代碼來源:query.ts


注:本文中的lodash.isEqual函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。