How to use the dustjs-linkedin.isArray function in dustjs-linkedin

To help you get started, we’ve selected a few dustjs-linkedin 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 darkspotinthecorner / DarkTip / src / darktip.js View on Github external
DarkTip.module = function(moduleId, dependencies) {
		var numdeps = 0;
		if (typeof repositoryModules[moduleId] !== 'undefined') {
			return repositoryModules[moduleId];
		}
		if (typeof dependencies === 'string') {
			dependencies = [dependencies];
		}
		if (dust.isArray(dependencies)) {
			numdeps = dependencies.length;
		}
		var Module = function(moduleId, dependencies) {
			var self       = this,
				cssClasses = [('darktip-module-' + moduleId)];
			if (numdeps > 0) {
				for (var i = 0; i < numdeps; i++) {
					if (typeof repositoryModules[dependencies[i]] === 'undefined') {
						log('Module "' + moduleId + '" could not be created! Dependant module "' + dependencies[i] + '" was not found.');
						return;
					} else {
						cssClasses.push('darktip-module-' + dependencies[i]);
					}
				};
			} 
			var createTooltipElement = function(content) {
github mutualmobile / lavaca / source / src / www / js / libs / dust-helpers-1.1.0.js View on Github external
"size": function( chunk, context, bodies, params ) {
    var key, value=0, nr, k;
    params = params || {};
    key = params.key;
    if (!key || key === true) { //undefined, null, "", 0
      value = 0;
    }
    else if(dust.isArray(key)) { //array
      value = key.length;
    }
    else if (!isNaN(parseFloat(key)) && isFinite(key)) { //numeric values
      value = key;
    }
    else if (typeof key  === "object") { //object test
      //objects, null and array all have typeof ojbect...
      //null and array are already tested so typeof is sufficient http://jsperf.com/isobject-tests
      nr = 0;
      for(k in key){
        if(Object.hasOwnProperty.call(key,k)){
          nr++;
        }
      }
      value = nr;
    } else {
github darkspotinthecorner / DarkTip / src / darktip.js View on Github external
merge = function(target, src) {
		var array = dust.isArray(src);
		var dst = array && [] || {};
		if (array) {
			target = target || [];
			dst = dst.concat(target);
			src.forEach(function(e, i) {
				if (typeof dst[i] === 'undefined') {
					dst[i] = e;
				} else if (typeof e === 'object') {
					dst[i] = merge(target[i], e);
				} else {
					if (target.indexOf(e) === -1) {
						dst.push(e);
					}
				}
			});
		} else {