Sha256: 7aad2f6e7cc1d5fe4cc80646eeef08e6331ca88a5def5bd3633cdb5d5815138a
Contents?: true
Size: 624 Bytes
Versions: 39
Compression:
Stored size: 624 Bytes
Contents
var utils = require('../utils') , nodes = require('../nodes'); /** * Splits the given `val` by `delim` * * @param {String} delim * @param {String|Ident} val * @return {Expression} * @api public */ module.exports = function split(delim, val){ utils.assertString(delim, 'delimiter'); utils.assertString(val, 'val'); var splitted = val.string.split(delim.string); var expr = new nodes.Expression(); var ItemNode = val instanceof nodes.Ident ? nodes.Ident : nodes.String; for (var i = 0, len = splitted.length; i < len; ++i) { expr.nodes.push(new ItemNode(splitted[i])); } return expr; };
Version data entries
39 entries across 20 versions & 2 rubygems