How to use the nullthrows function in nullthrows

To help you get started, we’ve selected a few nullthrows 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 facebookarchive / atom-ide-ui / modules / atom-ide-ui / pkg / atom-ide-debugger / lib / vsp / DebuggerModel.js View on Github external
async refreshCallStack(levels: ?number): Promise {
    if (!this.stopped) {
      return;
    }

    const supportsDelayLoading =
      nullthrows(this.process).session.capabilities
        .supportsDelayedStackTraceLoading === true;

    this._refreshInProgress = true;
    try {
      if (supportsDelayLoading) {
        const start = this._callStack.callFrames.length;
        const callStack = await this._getCallStackImpl(start, levels);
        if (start < this._callStack.callFrames.length) {
          // Set the stack frames for exact position we requested.
          // To make sure no concurrent requests create duplicate stack frames #30660
          this._callStack.callFrames.splice(
            start,
            this._callStack.callFrames.length - start,
          );
        }
        this._callStack.callFrames = this._callStack.callFrames.concat(
github parcel-bundler / parcel / packages / core / workers / src / child.js View on Github external
handleResponse(data: WorkerResponse): void {
    let idx = nullthrows(data.idx);
    let contentType = data.contentType;
    let content = data.content;
    let call = nullthrows(this.responseQueue.get(idx));

    if (contentType === 'error') {
      invariant(typeof content !== 'string');
      call.reject(new ThrowableDiagnostic({diagnostic: content}));
    } else {
      call.resolve(content);
    }

    this.responseQueue.delete(idx);

    // Process the next call
    this.processQueue();
  }
github parcel-bundler / parcel / packages / core / core / src / Transformation.js View on Github external
filePath,
      pipelineName,
    );
    let pipeline = {
      id: transformers.map(t => t.name).join(':'),

      transformers: transformers.map(transformer => ({
        name: transformer.name,
        config: configs.get(transformer.name)?.result,
        plugin: transformer.plugin,
      })),
      configs,
      options: this.options,
      resolverRunner: new ResolverRunner({
        config: new ParcelConfig(
          nullthrows(nullthrows(configs.get('parcel')).result),
          this.options.packageManager,
        ),
        options: this.options,
      }),

      pluginOptions: new PluginOptions(this.options),
      workerApi: this.workerApi,
    };

    return pipeline;
  }
github facebookarchive / atom-ide-ui / modules / nuclide-commons-ui / spec / openPreview-spec.js View on Github external
function getActiveTextEditor(): atom$TextEditor {
  return nullthrows(atom.workspace.getActiveTextEditor());
}
github magma / magma / symphony / app / fbcnms-packages / fbcnms-ui / components / design-system / FormField / FormField.js View on Github external
className={classNames(
          classes.root,
          {[classes.disabled]: disabled},
          {[classes.hasError]: hasError},
          className,
        )}>
        {label && (
          
        )}
        {children}
        {(helpText || (hasError && errorText)) && (
          
        )}
        {!helpText && !hasError && hasSpacer && (
          <div>
        )}
      </div>
    
  );
};
github parcel-bundler / parcel / packages / core / core / src / ConfigLoader.js View on Github external
async loadPluginConfig({
    plugin,
    env,
    isSource,
    filePath,
    meta: {parcelConfigPath},
  }: ConfigRequestDesc) {
    let config = createConfig({
      isSource,
      searchPath: filePath,
      env,
    });
    invariant(typeof parcelConfigPath === 'string');
    let pluginInstance = await loadPlugin(
      this.options.packageManager,
      nullthrows(plugin),
      parcelConfigPath,
    );
    if (pluginInstance.loadConfig != null) {
      await pluginInstance.loadConfig({
        config: new Config(config, this.options),
        options: this.options,
        logger: new PluginLogger({origin: nullthrows(plugin)}),
      });
    }

    return config;
  }
}
github parcel-bundler / parcel / packages / core / core / src / RequestTracker.js View on Github external
getRequestNode(id: string) {
    let node = nullthrows(this.getNode(id));
    invariant(node.type === 'request');
    return node;
  }
github expo / expo / packages / expo / src / av / Video.tsx View on Github external
setNativeProps(nativeProps: NativeProps) {
    const nativeVideo = nullthrows(this._nativeRef.current);
    nativeVideo.setNativeProps(nativeProps);
  }
github parcel-bundler / parcel / packages / core / core / src / ConfigLoader.js View on Github external
let config = createConfig({
      isSource,
      searchPath: filePath,
      env,
    });
    invariant(typeof parcelConfigPath === 'string');
    let pluginInstance = await loadPlugin(
      this.options.packageManager,
      nullthrows(plugin),
      parcelConfigPath,
    );
    if (pluginInstance.loadConfig != null) {
      await pluginInstance.loadConfig({
        config: new Config(config, this.options),
        options: this.options,
        logger: new PluginLogger({origin: nullthrows(plugin)}),
      });
    }

    return config;
  }
}
github parcel-bundler / parcel / packages / shared / scope-hoisting / src / formats / esmodule.js View on Github external
let binding = path.scope.getBinding(defaultExport);
          let insertPath = path;
          if (binding && !binding.constant) {
            insertPath =
              binding.constantViolations[binding.constantViolations.length - 1];
          }

          insertPath.insertAfter(
            t.exportDefaultDeclaration(t.identifier(defaultExport)),
          );
        }

        if (exportedIds.length > 0) {
          let specifiers = [];
          for (let id of exportedIds) {
            let exportName = nullthrows(exportedIdentifiers.get(id));
            rename(path.scope, id, exportName);
            exported.add(exportName);
            specifiers.push(
              t.exportSpecifier(
                t.identifier(exportName),
                t.identifier(exportName),
              ),
            );
          }

          path.insertAfter(t.exportNamedDeclaration(null, specifiers));
        }
      }
    },
  });

nullthrows

flow typed nullthrows

MIT
Latest version published 5 years ago

Package Health Score

65 / 100
Full package analysis

Popular nullthrows functions