This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/stylus/lib/functions/length.js

26 lines
480 B
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
var utils = require('../utils');
/**
* Return length of the given `expr`.
*
* @param {Expression} expr
* @return {Unit}
* @api public
*/
(module.exports = function length(expr){
if (expr) {
if (expr.nodes) {
var nodes = utils.unwrap(expr).nodes;
if (1 == nodes.length && 'object' == nodes[0].nodeName) {
return nodes[0].length;
} else {
return nodes.length;
}
} else {
return 1;
}
}
return 0;
}).raw = true;