UNPKG

@wbce-d9/schema

Version:

Utility for extracting information about existing DB schema

14 lines (13 loc) 405 B
/** * Strip leading/trailing quotes from a string and handle null values. */ export function stripQuotes(value) { if (value === null || value === undefined) { return null; } const trimmed = value.trim(); if ((trimmed.startsWith(`'`) && trimmed.endsWith(`'`)) || (trimmed.startsWith('"') && trimmed.endsWith('"'))) { return trimmed.slice(1, -1); } return value; }