本文整理汇总了TypeScript中lodash.cloneDeep函数的典型用法代码示例。如果您正苦于以下问题:TypeScript cloneDeep函数的具体用法?TypeScript cloneDeep怎么用?TypeScript cloneDeep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cloneDeep函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
$scope.$watch('auth.user', function(user) {
$scope.user = _.cloneDeep(user);
});
示例2: cloneDeep
const showDeleteInfo = (state = INITIAL_STATE, { viewpointId }) => {
const viewpointsMap = cloneDeep(state.viewpointsMap);
viewpointsMap[viewpointId].willBeRemoved = true;
return { ...state, viewpointsMap };
};
示例3: function
import: function(inputTemplate): ITemplate {
const _t = cloneDeep(this);
return _calcFromExistingTemplate(_t, inputTemplate);
},
示例4: function
.add<CropLiveSearchResult[]>("OF_SEARCH_RESULTS_OK", function(s, { payload }) {
let state = cloneDeep(s);
state.cropSearchResults = payload;
return state;
});
示例5: reset
reset() {
this.tenants = _.cloneDeep(this.initialTenants);
this.tenantsToCreate = [];
this.tenantsToUpdate = [];
}
示例6: factory
function factory() {
return new PrepackagedFilesystemProvider(_.cloneDeep(blob));
}
示例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: {
//.........这里部分代码省略.........
示例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);
};