1
0
Fork 0
mirror of synced 2024-07-09 00:06:05 +12:00
This commit is contained in:
mike12345567 2021-01-26 15:59:58 +00:00
parent 6219a66604
commit 9e798158c2

View file

@ -180,17 +180,17 @@ export function readableToRuntimeBinding(bindableProperties, textWithBindings) {
const boundValues = textWithBindings.match(CAPTURE_VAR_INSIDE_TEMPLATE) || [] const boundValues = textWithBindings.match(CAPTURE_VAR_INSIDE_TEMPLATE) || []
let result = textWithBindings let result = textWithBindings
for (let boundValue of boundValues) { for (let boundValue of boundValues) {
const binding = bindableProperties.find(({readableBinding}) => { const binding = bindableProperties.find(({ readableBinding }) => {
return boundValue.includes(readableBinding) return boundValue.includes(readableBinding)
}) })
let newBoundValue = INVALID_BINDING let newBoundValue = INVALID_BINDING
if (binding) { if (binding) {
newBoundValue = boundValue.replace(binding.readableBinding, binding.runtimeBinding) newBoundValue = boundValue.replace(
binding.readableBinding,
binding.runtimeBinding
)
} }
result = result.replace( result = result.replace(boundValue, newBoundValue)
boundValue,
newBoundValue
)
} }
return result return result
} }
@ -210,12 +210,12 @@ export function runtimeToReadableBinding(bindableProperties, textWithBindings) {
}) })
let newBoundValue = INVALID_BINDING let newBoundValue = INVALID_BINDING
if (binding) { if (binding) {
newBoundValue = boundValue.replace(binding.runtimeBinding, binding.readableBinding) newBoundValue = boundValue.replace(
binding.runtimeBinding,
binding.readableBinding
)
} }
result = result.replace( result = result.replace(boundValue, newBoundValue)
boundValue,
newBoundValue
)
} }
return result return result
} }