How to use the @jupyterlab/coreutils.PathExt.normalize function in @jupyterlab/coreutils

To help you get started, we’ve selected a few @jupyterlab/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 / tests / test-coreutils / src / path.spec.ts View on Github external
it('should normalize a string path', () => {
        const path = PathExt.normalize('./fixtures///b/../b/c.js');
        expect(path).to.equal('fixtures/b/c.js');
      });
github jupyterlab / jupyterlab / tests / test-coreutils / src / path.spec.ts View on Github external
it('should not return "." for an empty path', () => {
        const path = PathExt.normalize('');
        expect(path).to.equal('');
      });
    });
github jupyterlab / jupyterlab / packages / services / src / contents / index.ts View on Github external
normalize(path: string): string {
    const parts = path.split(':');
    if (parts.length === 1) {
      return PathExt.normalize(path);
    }
    return `${parts[0]}:${PathExt.normalize(parts.slice(1).join(':'))}`;
  }
github jupyterlab / jupyterlab / packages / services / src / contents / index.ts View on Github external
normalize(path: string): string {
    const parts = path.split(':');
    if (parts.length === 1) {
      return PathExt.normalize(path);
    }
    return `${parts[0]}:${PathExt.normalize(parts.slice(1).join(':'))}`;
  }
github jupyterlab / jupyterlab / packages / docmanager / src / manager.ts View on Github external
findWidget(
    path: string,
    widgetName: string | null = 'default'
  ): IDocumentWidget | undefined {
    let newPath = PathExt.normalize(path);
    let widgetNames = [widgetName];
    if (widgetName === 'default') {
      let factory = this.registry.defaultWidgetFactory(newPath);
      if (!factory) {
        return undefined;
      }
      widgetNames = [factory.name];
    } else if (widgetName === null) {
      widgetNames = this.registry
        .preferredWidgetFactories(newPath)
        .map(f => f.name);
    }

    for (let context of this._contextsForPath(newPath)) {
      for (const widgetName of widgetNames) {
        let widget = this._widgetManager.findWidget(context, widgetName);
github jupyterlab / jupyterlab / packages / docmanager / src / manager.ts View on Github external
findWidget(
    path: string,
    widgetName: string | null = 'default'
  ): IDocumentWidget | undefined {
    let newPath = PathExt.normalize(path);
    let widgetNames = [widgetName];
    if (widgetName === 'default') {
      let factory = this.registry.defaultWidgetFactory(newPath);
      if (!factory) {
        return undefined;
      }
      widgetNames = [factory.name];
    } else if (widgetName === null) {
      widgetNames = this.registry
        .preferredWidgetFactories(newPath)
        .map(f => f.name);
    }

    for (let context of this._contextsForPath(newPath)) {
      for (const widgetName of widgetNames) {
        let widget = this._widgetManager.findWidget(context, widgetName);
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / docmanager / src / manager.ts View on Github external
findWidget(
    path: string,
    widgetName: string | null = 'default'
  ): IDocumentWidget | undefined {
    let newPath = PathExt.normalize(path);
    let widgetNames = [widgetName];
    if (widgetName === 'default') {
      let factory = this.registry.defaultWidgetFactory(newPath);
      if (!factory) {
        return undefined;
      }
      widgetNames = [factory.name];
    } else if (widgetName === null) {
      widgetNames = this.registry
        .preferredWidgetFactories(newPath)
        .map(f => f.name);
    }

    for (let context of this._contextsForPath(newPath)) {
      for (const widgetName of widgetNames) {
        let widget = this._widgetManager.findWidget(context, widgetName);