UNPKG

cdk8s

Version:

This is the core library of Cloud Development Kit (CDK) for Kubernetes (cdk8s). cdk8s apps synthesize into standard Kubernetes manifests which can be applied to any Kubernetes cluster.

29 lines (26 loc) 850 B
'use strict'; function emptyScalarPosition(offset, before, pos) { if (before) { pos ?? (pos = before.length); for (let i = pos - 1; i >= 0; --i) { let st = before[i]; switch (st.type) { case 'space': case 'comment': case 'newline': offset -= st.source.length; continue; } // Technically, an empty scalar is immediately after the last non-empty // node, but it's more useful to place it after any whitespace. st = before[++i]; while (st?.type === 'space') { offset += st.source.length; st = before[++i]; } break; } } return offset; } exports.emptyScalarPosition = emptyScalarPosition;