當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。