How to use the metal.core.isDefAndNotNull function in metal

To help you get started, we’ve selected a few metal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deprecate / metal-router / src / Router.js View on Github external
		validator: val => core.isNumber(val) || !core.isDefAndNotNull(val),
		value: 30000
github deprecate / metal-router / src / Router.js View on Github external
maybeParseLastLoadedStateAsJson() {
		var state = this.router.lastLoadedState;
		try {
			return JSON.parse(state);
		} catch (err) {
			return core.isDefAndNotNull(state) ? state : {};
		}
	}
github metal / metal.js / src / SoyRenderer.js View on Github external
handleSurfaceCall_(templateComponentName, templateName, originalFn, data, opt_ignored, opt_ijData) {
		data = data || {};
		var surfaceData = {
			static: originalFn.static,
			templateComponentName: templateComponentName,
			templateData: data,
			templateName: templateName
		};
		var surfaceElementId;
		if (core.isDefAndNotNull(data.surfaceElementId)) {
			surfaceElementId = data.surfaceElementId;
		} else if (core.isDefAndNotNull(data.surfaceId)) {
			surfaceElementId = this.getSurfaceElementId(data.surfaceId.toString());
		} else {
			if (originalFn.private) {
				return originalFn.call(null, data, opt_ignored, opt_ijData);
			}
			surfaceElementId = this.generateSurfaceElementId(this.surfaceBeingRendered_, surfaceData);
		}
		return this.buildPlaceholder(surfaceElementId, surfaceData);
	}
github LiferayCloud / marble / packages / marble-select / src / Select.js View on Github external
this.closedWithKeyboard_ = true;
        this.expanded_ = false;
        break;
      case 38:
        this.focusedIndex_ = core.isDefAndNotNull(this.focusedIndex_)
          ? this.focusedIndex_
          : 1;
        this.focusIndex_(
          this.focusedIndex_ === 0
            ? this.items.length - 1
            : this.focusedIndex_ - 1
        );
        event.preventDefault();
        break;
      case 40:
        this.focusedIndex_ = core.isDefAndNotNull(this.focusedIndex_)
          ? this.focusedIndex_
          : -1;
        this.focusIndex_(
          this.focusedIndex_ === this.items.length - 1
            ? 0
            : this.focusedIndex_ + 1
        );
        event.preventDefault();
        break;
      }
    } else if (
      (keyCode === 13 || keyCode === 32) &&
      dom.hasClass(event.target, 'dropdown-select')
    ) {
      this.openedWithKeyboard_ = true;
      this.expanded_ = true;
github liferay / sennajs.com / vendor / senna / src / screen / RequestScreen.js View on Github external
load(path) {
		var cache = this.getCache();
		if (core.isDefAndNotNull(cache)) {
			return CancellablePromise.resolve(cache);
		}

		var body = null;
		var httpMethod = this.httpMethod;

		var headers = new MultiMap();
		Object.keys(this.httpHeaders).forEach(header => headers.add(header, this.httpHeaders[header]));

		if (globals.capturedFormElement) {
			body = new FormData(globals.capturedFormElement);
			httpMethod = RequestScreen.POST;
			if (UA.isIeOrEdge) {
				headers.add('If-None-Match', '"0"');
			}
		}
github metal / metal.js / src / surfaces / SurfaceRenderer.js View on Github external
createPlaceholderSurface_(parentSurfaceElementId, opt_surfaceElementId) {
		var surfaceElementId = opt_surfaceElementId;
		if (!core.isDefAndNotNull(surfaceElementId)) {
			surfaceElementId = this.generateSurfaceElementId(parentSurfaceElementId);
		}
		var surface = this.getSurfaceFromElementId(surfaceElementId);
		if (!surface) {
			surface = {
				surfaceElementId: surfaceElementId
			};
			this.addSurface(surfaceElementId, surface);
		}
		return surface;
	}
github metal / metal.js / src / SoyRenderer.js View on Github external
handleSurfaceCall_(templateComponentName, templateName, originalFn, data, opt_ignored, opt_ijData) {
		data = data || {};
		var surfaceData = {
			static: originalFn.static,
			templateComponentName: templateComponentName,
			templateData: data,
			templateName: templateName
		};
		var surfaceElementId;
		if (core.isDefAndNotNull(data.surfaceElementId)) {
			surfaceElementId = data.surfaceElementId;
		} else if (core.isDefAndNotNull(data.surfaceId)) {
			surfaceElementId = this.getSurfaceElementId(data.surfaceId.toString());
		} else {
			if (originalFn.private) {
				return originalFn.call(null, data, opt_ignored, opt_ijData);
			}
			surfaceElementId = this.generateSurfaceElementId(this.surfaceBeingRendered_, surfaceData);
		}
		return this.buildPlaceholder(surfaceElementId, surfaceData);
	}