gatsby-node-helpers

  • Version 1.2.1
  • Published
  • 58.9 kB
  • 2 dependencies
  • MIT license

Install

npm i gatsby-node-helpers
yarn add gatsby-node-helpers
pnpm add gatsby-node-helpers

Overview

Gatsby node helper functions to aid node creation.

Index

Functions

function createNodeHelpers

createNodeHelpers: ({
typePrefix,
fieldPrefix,
createNodeId: gatsbyCreateNodeId,
createContentDigest: gatsbyCreateContentDigest,
}: CreateNodeHelpersParams) => NodeHelpers;
  • Creates Gatsby node helper functions to aid node creation.

Interfaces

interface IdentifiableRecord

interface IdentifiableRecord {}
  • A record that can be globally identified using its id field.

property id

id: Stringable;

    index signature

    [key: string]: any;

      interface NodeHelpers

      interface NodeHelpers {}
      • Gatsby node helper functions to aid node creation.

      property createFieldName

      createFieldName: (parts: string | string[]) => string;
      • Creates a namespaced field name in camel case. Nodes created using a createNodeFactory function will automatically have namespaced fields using this function ONLY if the name conflicts with Gatsby's reserved fields.

        Parameter parts

        Parts of the field name. If more than one string is provided, they will be concatenated in camel case.

        Namespaced field name.

      property createNodeFactory

      createNodeFactory: (
      nameParts: string | string[],
      options?: CreateNodeFactoryOptions
      ) => (node: IdentifiableRecord) => gatsby.NodeInput;
      • Creates a function that will convert an identifiable record (one that has an id field) to a valid input for Gatsby's createNode action.

        Parameter nameParts

        Parts of the type name for the resulting factory. All records called with the resulting function will have a type name based on this parameter.

        Parameter options

        Options to control the resulting function's output.

        A function that converts an identifiable record to a valid input for Gatsby's createNode action.

      property createNodeId

      createNodeId: (parts: string | string[]) => string;
      • Creates a deterministic node ID based on the typePrefix option provided to createNodeHelpers and the provided parts argument. Providing the same parts will always return the same result.

        Parameter parts

        Strings to globally identify a node within the domain of the node helpers.

        Node ID based on the provided parts.

      property createTypeName

      createTypeName: (parts: string | string[]) => string;
      • Creates a namespaced type name in Pascal case. Nodes created using a createNodeFactory function will automatically be namespaced using this function.

        Parameter parts

        Parts of the type name. If more than one string is provided, they will be concatenated in Pascal case.

        Namespaced type name.

      interface Stringable

      interface Stringable {}
      • A value that can be converted to a string using toString().

      method toString

      toString: () => string;

        Package Files (1)

        Dependencies (2)

        Dev Dependencies (16)

        Peer Dependencies (1)

        Badge

        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/gatsby-node-helpers.

        • Markdown
          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/gatsby-node-helpers)
        • HTML
          <a href="https://www.jsdocs.io/package/gatsby-node-helpers"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>