6fe9ed102106b3dec671ad9f6f13d940cbb568cd
[yaffs-website] / node_modules / uncss / node_modules / lodash / split.js
1 var toString = require('./toString');
2
3 /**
4  * Splits `string` by `separator`.
5  *
6  * **Note:** This method is based on [`String#split`](https://mdn.io/String/split).
7  *
8  * @static
9  * @memberOf _
10  * @category String
11  * @param {string} [string=''] The string to split.
12  * @param {RegExp|string} separator The separator pattern to split by.
13  * @param {number} [limit] The length to truncate results to.
14  * @returns {Array} Returns the new array of string segments.
15  * @example
16  *
17  * _.split('a-b-c', '-', 2);
18  * // => ['a', 'b']
19  */
20 function split(string, separator, limit) {
21   return toString(string).split(separator, limit);
22 }
23
24 module.exports = split;