🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

sanity-diff-patch

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanity-diff-patch - npm Package Compare versions

Comparing version

to
3.0.4

6

dist/index.js
import { makeDiff, cleanupEfficiency, stringifyPatches, makePatches } from '@sanity/diff-match-patch';
const IS_DOTTABLE_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
function pathToString(path) {

@@ -12,5 +13,6 @@ return path.reduce((target, segment, i) => {

return "".concat(target, "[").concat(segment, "]");
} else if (typeof segment === "string" && (/^\d+$/.test(segment) || segment.includes("-"))) {
return "".concat(target, "[\"").concat(segment, "\"]");
}
if (typeof segment === "string" && !IS_DOTTABLE_RE.test(segment)) {
return "".concat(target, "['").concat(segment, "']");
}
if (typeof segment === "string") {

@@ -17,0 +19,0 @@ const separator = i === 0 ? "" : ".";

{
"name": "sanity-diff-patch",
"version": "3.0.3",
"version": "3.0.4",
"description": "Generates a set of Sanity patches needed to change an item (usually a document) from one shape to another",

@@ -5,0 +5,0 @@ "sideEffects": false,

import type {KeyedSanityObject} from './diffPatch.js'
const IS_DOTTABLE_RE = /^[A-Za-z_][A-Za-z0-9_]*$/
/**

@@ -40,6 +42,8 @@ * A segment of a path

return `${target}[${segment}]`
} else if (typeof segment === 'string' && (/^\d+$/.test(segment) || segment.includes('-'))) {
return `${target}["${segment}"]`
}
if (typeof segment === 'string' && !IS_DOTTABLE_RE.test(segment)) {
return `${target}['${segment}']`
}
if (typeof segment === 'string') {

@@ -46,0 +50,0 @@ const separator = i === 0 ? '' : '.'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet