Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.mount = (component, container, props): any => {
if (isString(container)) {
container = document.querySelector(container)!
if (!container) {
__DEV__ &&
warn(`Failed to mount app: mount target selector returned null.`)
return
}
}
if (
__RUNTIME_COMPILE__ &&
!isFunction(component) &&
!component.render &&
!component.template
) {
component.template = container.innerHTML
}
// clear content before mounting
container.innerHTML = ''
return mount(component, container, props)
}
function setSelected(el: HTMLSelectElement, value: any) {
const isMultiple = el.multiple
if (isMultiple && !isArray(value)) {
__DEV__ &&
warn(
`<select multiple=""> expects an Array value for its binding, ` +
`but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
)
return
}
for (let i = 0, l = el.options.length; i < l; i++) {
const option = el.options[i]
const optionValue = getValue(option)
if (isMultiple) {
option.selected = looseIndexOf(value, optionValue) > -1
} else {
if (looseEqual(getValue(option), value)) {
el.selectedIndex = i
return
}
}</select>
function validateDuration(val: unknown) {
if (typeof val !== 'number') {
warn(
` explicit duration is not a valid number - ` +
`got ${JSON.stringify(val)}.`
)
} else if (isNaN(val)) {
warn(
` explicit duration is NaN - ` +
'the duration expression might be incorrect.'
)
}
}
function validateDuration(val: unknown) {
if (typeof val !== 'number') {
warn(
` explicit duration is not a valid number - ` +
`got ${JSON.stringify(val)}.`
)
} else if (isNaN(val)) {
warn(
` explicit duration is NaN - ` +
'the duration expression might be incorrect.'
)
}
}