Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).keydown(function(e){
var enteredKey = e.which || e.charCode || e.keyCode;
// If tab pressed.
if (e.shiftKey && _.isEqual(enteredKey, 9)) {
typeDropdown.dropdownButton.trigger("click");
}
}).keyup(function(){
self.getModel().setName($(this).val());
// Clone before writing
newValues[key] = _.cloneDeep(value)
update = true
}
// Handle normal query (sets array of documents and array of ids)
} else {
let ids = []
let value = query.get().filter(doc => {
if (doc) {
ids.push(doc.id)
return true
} else {
return false
}
})
if (!_.isEqual(value, this.state[key])) {
// Clone before writing
newValues[key] = _.cloneDeep(value)
update = true
}
let idsName = getIdsName(key)
if (!_.isEqual(ids, this.state[idsName])) {
newValues[idsName] = ids
update = true
}
}
if (update) this.setState(newValues)
}
onViewStoreChange(newState: StateUpdate) {
const selectedFields = Set(get(newState, 'state.fields'));
if (!isEqual(this.selectedFields, selectedFields)) {
this.selectedFields = selectedFields;
this._trigger();
}
},
componentDidMount() {
const {
fetchOnInit,
visible,
dataProviderFromState,
dataProvider,
} = this.props;
if (
fetchOnInit &&
visible &&
isEqual(dataProvider, dataProviderFromState)
) {
this.onFetch();
}
}
shouldComponentUpdate(nextProps, nextState) {
if (!isEqual(this.props.children, nextProps.children)) {
this.setData(nextProps.children);
return true;
} else if (!isEqual(this.state.items, nextState.items)) {
return true;
} else {
return false;
}
}
if (
nextProps.metricType !== this.props.metricType ||
nextProps.startDate !== this.props.startDate ||
nextProps.endDate !== this.props.endDate ||
nextProps.width !== this.props.width ||
nextProps.padding !== this.props.padding ||
nextProps.height !== this.props.height ||
nextProps.series !== this.props.series
) {
scales = this.getScales(nextProps);
if (this.state.selectedDate != null) {
selectedDatePos = this.getSelectedDatePos(scales.xScale, this.state.selectedDate);
}
}
if (!isEqual(nextProps.selectedDate, this.props.selectedDate)) {
const xScale = scales ? scales.xScale : this.state.xScale;
selectedDatePos = this.getSelectedDatePos(xScale, nextProps.selectedDate);
}
if (scales || selectedDatePos) {
if (scales) {
this.setState({ ...scales });
}
if (selectedDatePos) {
this.setState({ ...selectedDatePos });
}
if (selectedDatePos && nextProps.updateTooltip) {
nextProps.updateTooltip(
selectedDatePos.selectedDate,
selectedDatePos.selectedDateXPos,
export function arrayAreSimilar(a1, a2){
let a1_tmp = deepcopy(a1).sort();
let a2_tmp = deepcopy(a2).sort();
return lodash.isEqual(a1_tmp, a2_tmp);
}
search = (part = null) => {
const {
onSearch,
search: { query, mismatch },
seq
} = this.props;
if (!(seq || (part && part.seq))) {
return;
}
const { results } = search(query, mismatch, seq || part.seq);
if (isEqual(results, this.state.search)) {
return;
}
this.setState({ search: results });
onSearch(results);
};
function matchValues(item, value) {
if(valuesAreObjectIds(item, value)){
return item.equals(value);
}
return _.isEqual(item, value);
}