Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
maybeSetBasePath_() {
var basePath = this.baseElement.getAttribute(dataAttributes.basePath);
if (isDefAndNotNull(basePath)) {
this.app.setBasePath(basePath);
console.log('Senna scanned base path ' + basePath);
}
}
assertGivenIfRequired_(name) {
const config = this.stateConfigs_[name];
if (config.required) {
const info = this.getStateInfo(name);
const value = info.state === State.KeyStates.INITIALIZED ?
this.get(name) :
this.initialValues_[name];
if (!isDefAndNotNull(value)) {
let errorMessage = `The property called "${name}" is required but didn't receive a value.`;
if (this.shouldThrowValidationError()) {
throw new Error(errorMessage);
} else {
console.error(errorMessage);
}
}
}
}
Object.keys(surfaces).forEach((id) => {
var surfaceContent = nextScreen.getSurfaceContent(id, params);
surfaces[id].addContent(nextScreen.getId(), surfaceContent);
console.log('Screen [' + nextScreen.getId() + '] add content to surface ' +
'[' + surfaces[id] + '] [' + (isDefAndNotNull(surfaceContent) ? '...' : 'empty') + ']');
});
}
if (!getData(comp).rootElementReached) {
const elementClasses = comp
.getDataManager()
.get(comp, 'elementClasses');
if (elementClasses) {
addElementClasses_(elementClasses, config);
}
}
convertListenerNamesToFns(comp, config);
const call = buildCallFromConfig(tag, config);
const node = getOriginalFn('elementOpen')(...call);
resetNodeData_(node);
updateElementIfNotReached_(comp, node);
if (isDefAndNotNull(config.ref)) {
owner.refs[config.ref] = node;
}
owner.getRenderer().handleNodeRendered(node);
return node;
}
export function prepend(parent, child) {
if (isString(child)) {
child = buildFragment(child);
}
if (!isNodeListLike(child) && !isDefAndNotNull(parent.firstChild)) {
return append(parent, child);
}
if (isNodeListLike(child)) {
const childArr = Array.prototype.slice.call(child);
for (let i = childArr.length - 1; i >= 0; i--) {
parent.insertBefore(childArr[i], parent.firstChild);
}
} else {
parent.insertBefore(child, parent.firstChild);
}
return child;
}
validatorEventsFn_(val) {
return !isDefAndNotNull(val) || isObject(val);
}
function fixCheckedAttr_(name, value) {
if (name === 'checked') {
value = isDefAndNotNull(value) && value !== false;
}
return value;
}
export function isNodeListLike(val) {
return (
isDefAndNotNull(val) &&
typeof val.length === 'number' &&
typeof val.item === 'function'
);
}
maybeParseLinkRouteHandler_(link) {
var handler = link.getAttribute('type');
if (isDefAndNotNull(handler)) {
handler = object.getObjectByName(handler);
}
return handler;
}
addContent(screenId, opt_content) {
var child = this.defaultChild;
if (isDefAndNotNull(opt_content)) {
child = this.getChild(screenId);
if (child) {
removeChildren(child);
} else {
child = this.createChild(screenId);
this.transition(child, null);
}
append(child, opt_content);
}
var element = this.getElement();
if (element && child) {
append(element, child);
}