How to use @requestnetwork/data-format - 2 common examples

To help you get started, we’ve selected a few @requestnetwork/data-format 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 RequestNetwork / requestNetwork / packages / request-client.js / src / api / content-data-extension.ts View on Github external
public createExtensionsDataForCreation(content: any): any {
    if (DataFormat.isKnownFormat(content)) {
      const { valid, errors } = DataFormat.validate(content);

      if (!valid) {
        const errorsToShow = errors.map((e: any) => JSON.stringify(e)).join('\n');
        throw new Error(
          `The content data seem to follow a request format but contains errors: ${errorsToShow}`,
        );
      }
    }

    return this.extension.createCreationAction({ content });
  }
github RequestNetwork / requestNetwork / packages / request-client.js / src / api / content-data-extension.ts View on Github external
public createExtensionsDataForCreation(content: any): any {
    if (DataFormat.isKnownFormat(content)) {
      const { valid, errors } = DataFormat.validate(content);

      if (!valid) {
        const errorsToShow = errors.map((e: any) => JSON.stringify(e)).join('\n');
        throw new Error(
          `The content data seem to follow a request format but contains errors: ${errorsToShow}`,
        );
      }
    }

    return this.extension.createCreationAction({ content });
  }

@requestnetwork/data-format

Data format for the Request Network protocol.

MIT
Latest version published 5 days ago

Package Health Score

76 / 100
Full package analysis