本文整理汇总了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);
}
}
示例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);
}
示例3:
initiallySelectedSubtotalRows.forEach((sp)=> {
if (_.isEqual(node.sectorPath(), sp))
node.toggleSelect(true);
});
示例4: return
return (p: FixtureStateProps) => isEqual(p.elementId, elementId);
示例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);
}
示例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;
//.........这里部分代码省略.........
示例7:
scope.$watch(prop, (next, prev) => {
if (isUndefined(next) || isEqual(next, prev)) {
return;
}
scope.setAppData(keyPath, next);
});
示例8: isEqual
return allowBoolOrArray.some(item => isEqual(item, path))
示例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);
}
}
示例10: isEqual
return keysA.every(key => isEqual(a[key], b[key]));