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

Version Path
ela-4.1.6 node_modules/stylus/lib/functions/split.js
ela-4.1.6 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-4.1.5 node_modules/stylus/lib/functions/split.js
ela-4.1.5 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-4.1.4 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-4.1.4 node_modules/stylus/lib/functions/split.js
ela-4.1.3 node_modules/stylus/lib/functions/split.js
ela-4.1.3 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-4.1.2 node_modules/stylus/lib/functions/split.js
ela-4.1.2 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-4.1.1 node_modules/stylus/lib/functions/split.js
ela-4.1.1 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-4.1.0 node_modules/stylus/lib/functions/split.js
ela-4.1.0 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-4.0.0 node_modules/stylus/lib/functions/split.js
ela-4.0.0 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-3.4.3 node_modules/stylus/lib/functions/split.js
ela-3.4.3 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-3.4.2 node_modules/nib/node_modules/stylus/lib/functions/split.js
ela-3.4.2 node_modules/stylus/lib/functions/split.js