How to use the es5-ext/array/#/compact.call function in es5-ext

To help you get started, we’ve selected a few es5-ext 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 medikoo / domjs / scripts / dom-to-domjs.js View on Github external
attributes = function (attrs) {
	attrs = compact.call(map.call(attrs, function (attr) {
		if (startsWith.call(attr.name, 'data-')) return null;
		return (!re.test(attr.name) ? ('\'' + attr.name + '\'') : attr.name) +
			': ' + text(attr.value);
	}));

	if (!attrs.length) return null;
	return '{ ' + attrs.join(', ') + ' }';
};
github medikoo / domjs / scripts / dom-to-domjs.js View on Github external
element = function (dom, nest) {
	return dom.nodeName.toLowerCase() + '(' +
		compact.call([dom.attributes.length ? attributes(dom.attributes) : null,
			dom.childNodes.length ? childNodes(dom.childNodes, nest,
				dom.attributes.length) : null]).join(', ') + ')';
};
github medikoo / domjs / scripts / dom-to-domjs.js View on Github external
childNodes = function (nodes, nest, doBreak) {
	var firstDone;
	return compact.call(map.call(nodes, function (node, idx) {
		var str, type = node.nodeType;
		if (type === 1) {
			str = ((doBreak || firstDone) ? ('\n' + repeat.call('\t', nest)) : '') +
				element(node, nest + 1);
			firstDone = true;
			return str;
		}
		if ((type === 3) || (type === 4)) {
			if (node.data.trim()) {
				str = (idx ? ' ' : '') + text2(node.data.trim());
				firstDone = true;
				return str;
			}
			return null;
		}
		if (type === 8) return null;
github medikoo / serverless-plugin-dynamodb-autoscaling / index.js View on Github external
.map(resourceName => {
					const resource = this.resources[resourceName];
					if (resource.Type !== "AWS::DynamoDB::Table") return null;
					const configList = compact.call(
						objToArray(
							resolvedPluginConfig,
							(config, pattern) =>
								minimatch(resourceName, pattern) ? copyDeep(config) : null
						)
					);
					return {
						resource: { name: resourceName, value: resource },
						config: assignDeep({}, copyDeep(tableDefaults), ...configList)
					};
				})
				.filter(Boolean);