MCPcopy Create free account
hub / github.com/porsager/postgres / parseEvent

Function parseEvent

cf/src/subscribe.js:267–278  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

265}
266
267function parseEvent(x) {
268 const xs = x.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i) || []
269
270 if (!xs)
271 throw new Error('Malformed subscribe pattern: ' + x)
272
273 const [, command, path, key] = xs
274
275 return (command || '*')
276 + (path ? ':' + (path.indexOf('.') === -1 ? 'public.' + path : path) : '')
277 + (key ? '=' + key : '')
278}

Callers 1

subscribeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected