当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lodash.cloneDeep函数代码示例

本文整理汇总了TypeScript中lodash.cloneDeep函数的典型用法代码示例。如果您正苦于以下问题:TypeScript cloneDeep函数的具体用法?TypeScript cloneDeep怎么用?TypeScript cloneDeep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cloneDeep函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

 $scope.$watch('auth.user', function(user) {
   $scope.user = _.cloneDeep(user);
 });
开发者ID:carolinagc,项目名称:paperhive-frontend,代码行数:3,代码来源:settings.ts

示例2: cloneDeep

const showDeleteInfo = (state = INITIAL_STATE, { viewpointId }) => {
	const viewpointsMap = cloneDeep(state.viewpointsMap);
	viewpointsMap[viewpointId].willBeRemoved = true;

	return { ...state, viewpointsMap };
};
开发者ID:3drepo,项目名称:3drepo.io,代码行数:6,代码来源:viewpoints.redux.ts

示例3: function

 import: function(inputTemplate): ITemplate {
   const _t = cloneDeep(this);
   return _calcFromExistingTemplate(_t, inputTemplate);
 },
开发者ID:arminhammer,项目名称:wolkenkratzer,代码行数:4,代码来源:index.ts

示例4: function

 .add<CropLiveSearchResult[]>("OF_SEARCH_RESULTS_OK", function(s, { payload }) {
   let state = cloneDeep(s);
   state.cropSearchResults = payload;
   return state;
 });
开发者ID:bengro,项目名称:farmbot-web-frontend,代码行数:5,代码来源:reducer.ts

示例5: reset

 reset() {
   this.tenants = _.cloneDeep(this.initialTenants);
   this.tenantsToCreate = [];
   this.tenantsToUpdate = [];
 }
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:5,代码来源:tenants.controller.ts

示例6: factory

 function factory() {
     return new PrepackagedFilesystemProvider(_.cloneDeep(blob));
 }
开发者ID:DirtyHairy,项目名称:6502.ts,代码行数:3,代码来源:provider.ts

示例7: describe

describe('fetchMore on an observable query with connection', () => {
  const query = gql`
    query Comment($repoName: String!, $start: Int!, $limit: Int!) {
      entry(repoFullName: $repoName, start: $start, limit: $limit)
        @connection(key: "repoName") {
        comments {
          text
        }
      }
    }
  `;
  const transformedQuery = gql`
    query Comment($repoName: String!, $start: Int!, $limit: Int!) {
      entry(repoFullName: $repoName, start: $start, limit: $limit) {
        comments {
          text
          __typename
        }
        __typename
      }
    }
  `;

  const variables = {
    repoName: 'org/repo',
    start: 0,
    limit: 10,
  };
  const variablesMore = assign({}, variables, { start: 10, limit: 10 });

  const result: any = {
    data: {
      __typename: 'Query',
      entry: {
        __typename: 'Entry',
        comments: [],
      },
    },
  };
  const resultMore = cloneDeep(result);

  for (let i = 1; i <= 10; i++) {
    result.data.entry.comments.push({
      text: `comment ${i}`,
      __typename: 'Comment',
    });
  }
  for (let i = 11; i <= 20; i++) {
    resultMore.data.entry.comments.push({
      text: `comment ${i}`,
      __typename: 'Comment',
    });
  }

  let latestResult: any = null;

  let client: ApolloClient;
  let link: any;
  let sub: any;

  function setup(...mockedResponses: any[]) {
    link = mockSingleLink(
      {
        request: {
          query: transformedQuery,
          variables,
        },
        result,
      },
      ...mockedResponses,
    );

    client = new ApolloClient({
      link,
      cache: new InMemoryCache(),
    });

    const obsHandle = client.watchQuery<any>({
      query,
      variables,
    });
    sub = obsHandle.subscribe({
      next(queryResult) {
        // do nothing
        latestResult = queryResult;
      },
    });

    return Promise.resolve(obsHandle);
  }

  function unsetup() {
    sub.unsubscribe();
    sub = null;
  }

  it('fetchMore with connection results merging', () => {
    latestResult = null;
    return setup({
      request: {
//.........这里部分代码省略.........
开发者ID:NewSpring,项目名称:apollo-client,代码行数:101,代码来源:fetchMore.ts

示例8:

 $scope.duplicate = variable => {
   const clone = _.cloneDeep(variable.getSaveModel());
   $scope.current = variableSrv.createVariableFromModel(clone);
   $scope.current.name = 'copy_of_' + variable.name;
   variableSrv.addVariable($scope.current);
 };
开发者ID:acedrew,项目名称:grafana,代码行数:6,代码来源:editor_ctrl.ts


注:本文中的lodash.cloneDeep函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。