if ( className === GraphQLConfigClassName && isEqual(query, { objectId: GraphQLConfigId }) ) { const graphQLConfigRecord = getConfigFromDb(); if ( className === GraphQLConfigClassName && isEqual(query, { objectId: GraphQLConfigId }) && update && !!update[GraphQLConfigKey] && fullQueryOptions && isEqual(fullQueryOptions, { upsert: true }) ) { setConfigOnDb(update[GraphQLConfigKey]);
function isEqualState(value, other) { return isEqual(value, other, function (current, next) { if (current === next) { return true; } return compare(current, next, isImmutable, isEqualImmutable); }); }
componentDidUpdate({ addressValidationResults: prevAddressValidationResults }) { const { addressValidationResults } = this.props; if ( addressValidationResults && prevAddressValidationResults && !isEqual(addressValidationResults, prevAddressValidationResults) ) { this.handleValidationErrors(); } }
const cycleCore = (currentValue, ...values) => { const cycleValues = Array.isArray(values[0]) ? values[0] : values const currentIndex = cycleValues.findIndex(x => isEqual(x, currentValue)) const newIndex = currentIndex === cycleValues.length - 1 ? 0 : currentIndex + 1 return cycleValues[newIndex] }
// Override state, if need be. componentWillReceiveProps (nextProps) { const newSelected = nextProps.selected const oldSelected = this.props.selected const isValid = !isEqual(newSelected, oldSelected) if (isValid) { this.setState({ selected: newSelected }) } }
const areNodesMeregable = (x, y) => { if (x.type !== y.type) { return false; } if (x.type === 'text') { return true; } if (!x.children || !y.children) { return false; } const xBase = 'children' in x ? omit(x, 'children') : x; const yBase = 'children' in y ? omit(y, 'children') : y; return isEqual(xBase, yBase); }
componentDidUpdate (prevProps) { if (!isEqual(prevProps.data, this.props.data) && this.state.selectedRow && !this.props.selectedRow) { this.setState({ selectedRow: null }) } }
export default async function isWebhookRegistered( options: MinionOptions, registry: Registry ): Promise<boolean> { const maybeHook = await registry.getHook(options.id); if (maybeHook instanceof Error) { throw maybeHook; } const newWebhookConfig = buildWebhookConfig(options); return maybeHook .map( (hook) => isEqual(hook.config, newWebhookConfig) && hook.url === getWebhookUrl(options) ) .valueOr(false); }
const useService = (service, params) => { const prevParams = useRef(null) const [callback, { loading, error, response }] = useServiceCallback(service) useEffect(() => { if (!isEqual(prevParams.current, params)) { prevParams.current = params callback(params) } }) return { loading, error, response } }
function isEqualValue(value, other) { if (value === other) { return true; } var isImmutableDS = isEqualImmutableDS(value, other); if (isImmutableDS !== undefined) { return isImmutableDS; } return isEqual(value, other, (current, next) => { if (current === next) { return true; } if (isFunction(current) && isFunction(next)) { return current.toString() === next.toString(); } return isEqualImmutableDS(current, next); }); }
function isEqualProps(currentProps, nextProps) { var haveSameKeys = isEqual( keys(currentProps).sort(), keys(nextProps).sort() ); if (!haveSameKeys) { return false; } return every(keys(currentProps), (k) => isEqualValue(currentProps[k], nextProps[k])); }
// Update state, if need be. componentWillReceiveProps (nextProps) { const isValid = !isEqual(nextProps, this.props) if (isValid) { this.setState({ pageCurrent: nextProps.pageCurrent, sortDirection: nextProps.sortDirection, sortIndex: nextProps.sortIndex }) } }
createSelectorCreator(defaultMemoize, (val1, val2) => { return val1 === val2 || isEqual(val1, val2); })
shouldComponentUpdate(nextProps, nextState) { if(isEqual(nextState, this.state)) { console.log('same!', {nextState, state: this.state}) return false } return true }
const equals = (left, right) => isEqual(left, right)