How to use the @sanity/mutator.arrayToJSONMatchPath function in @sanity/mutator

To help you get started, we’ve selected a few @sanity/mutator 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 sanity-io / sanity / packages / @sanity / form-builder / examples / schema-testbed / components / SchemaForm.js View on Github external
function logPatch(patch) {
  const {type, path, ...rest} = patch
  console.log(
    // eslint-disable-line no-console
    '%c%s%c %s =>',
    'color:#2097ac',
    type,
    'color:inherit',
    arrayToJSONMatchPath(path || []),
    rest
  )
}
github sanity-io / sanity / packages / @sanity / form-builder / src / sanity / utils / convertPath.ts View on Github external
export function toGradient(formBuilderPath: Path): string {
  return arrayToJSONMatchPath(formBuilderPath)
}
github sanity-io / sanity / packages / @sanity / form-builder / src / sanity / utils / gradientPatchAdapter.ts View on Github external
function toGradientPatch(patch: Patch): GradientPatch {
  const matchPath = arrayToJSONMatchPath(patch.path || [])
  if (patch.type === 'insert') {
    const {position, items} = patch
    return {
      insert: {
        [position]: matchPath,
        items: items
      }
    }
  }

  if (patch.type === 'unset') {
    return {
      unset: [matchPath]
    }
  }
github sanity-io / sanity / packages / @sanity / form-builder / src / sanity / utils / toGradientPatch.js View on Github external
export default function toGradientPatch(patch) {
  const matchPath = arrayToJSONMatchPath(patch.path || [])
  if (patch.type === 'insert') {
    const {position, items} = patch
    return {
      insert: {
        [position]: matchPath,
        items: items
      }
    }
  }

  if (patch.type === 'unset') {
    return {
      unset: [matchPath]
    }
  }
github sanity-io / sanity / packages / @sanity / block-editor / src / Syncer.js View on Github external
function samePath(path, otherPath) {
  return arrayToJSONMatchPath(path) === arrayToJSONMatchPath(otherPath)
}

@sanity/mutator

A set of models to make it easier to utilize the powerful real time collaborative features of Sanity

MIT
Latest version published 3 days ago

Package Health Score

98 / 100
Full package analysis