complete redesign: use nodejs on server instead of php - documentation to be updated
This commit is contained in:
25
nodejs/node_modules/stylus/lib/functions/split.js
generated
vendored
Normal file
25
nodejs/node_modules/stylus/lib/functions/split.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
};
|
Reference in New Issue
Block a user