• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.isEqual函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.isError函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.isEmpty函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap