How to use the @lumino/coreutils.JSONExt.deepEqual function in @lumino/coreutils

To help you get started, we’ve selected a few @lumino/coreutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / packages / completer / src / model.ts View on Github external
set original(newValue: Completer.ITextState | null) {
    let unchanged =
      this._original === newValue ||
      (this._original &&
        newValue &&
        JSONExt.deepEqual(newValue, this._original));
    if (unchanged) {
      return;
    }

    this._reset();

    // Set both the current and original to the same value when original is set.
    this._current = this._original = newValue;

    this._stateChanged.emit(undefined);
  }
github jupyterlab / jupyterlab / packages / completer / src / model.ts View on Github external
set current(newValue: Completer.ITextState | null) {
    const unchanged =
      this._current === newValue ||
      (this._current && newValue && JSONExt.deepEqual(newValue, this._current));

    if (unchanged) {
      return;
    }

    const original = this._original;

    // Original request must always be set before a text change. If it isn't
    // the model fails silently.
    if (!original) {
      return;
    }

    const cursor = this._cursor;

    // Cursor must always be set before a text change. This happens
github jupyterlab / jupyterlab / tests / test-completer / src / model.spec.ts View on Github external
it('should return the typeMap', () => {
        let model = new CompleterModel();
        let options = ['foo'];
        let typeMap = { foo: 'instance' };
        model.setOptions(options, typeMap);
        expect(JSONExt.deepEqual(model.typeMap(), typeMap)).to.be.ok;
      });
    });
github jupyterlab / jupyterlab / packages / observables / src / modeldb.ts View on Github external
set(value: JSONValue): void {
    let oldValue = this._value;
    if (JSONExt.deepEqual(oldValue, value)) {
      return;
    }
    this._value = value;
    this._changed.emit({
      oldValue: oldValue,
      newValue: value
    });
  }
github jupyterlab / jupyterlab / packages / services / src / kernelspec / manager.ts View on Github external
protected async requestSpecs(): Promise {
    const specs = await restapi.getSpecs(this.serverSettings);
    if (this.isDisposed) {
      return;
    }
    if (!JSONExt.deepEqual(specs, this._specs)) {
      this._specs = specs;
      this._specsChanged.emit(specs);
    }
  }
github jupyterlab / jupyterlab / packages / statusbar / src / defaults / kernelStatus.tsx View on Github external
private _triggerChange(
      oldState: [string, string, string],
      newState: [string, string, string]
    ) {
      if (JSONExt.deepEqual(oldState, newState)) {
        this.stateChanged.emit(void 0);
      }
    }
github jupyterlab / jupyterlab / packages / completer / src / model.ts View on Github external
setOptions(
    newValue: IterableOrArrayLike,
    typeMap?: Completer.TypeMap
  ) {
    const values = toArray(newValue || []);
    const types = typeMap || {};

    if (
      JSONExt.deepEqual(values, this._options) &&
      JSONExt.deepEqual(types, this._typeMap)
    ) {
      return;
    }
    if (values.length) {
      this._options = values;
      this._typeMap = types;
      this._orderedTypes = Private.findOrderedTypes(types);
    } else {
      this._options = [];
      this._typeMap = {};
      this._orderedTypes = [];
    }
    this._stateChanged.emit(undefined);
  }
github jupyterlab / jupyterlab / packages / settingeditor / src / plugineditor.ts View on Github external
set state(state: SettingEditor.IPluginLayout) {
    if (JSONExt.deepEqual(this.state, state)) {
      return;
    }

    this._rawEditor.sizes = state.sizes;
    this.update();
  }
github jupyterlab / lumino / packages / widgets / src / menu.ts View on Github external
return ArrayExt.findLastValue(this._commands.keyBindings, kb => {
          return kb.command === command && JSONExt.deepEqual(kb.args, args);
        }) || null;
      }