mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Bump to v4.0.0.
This commit is contained in:
24
split.js
Normal file
24
split.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import toString from './toString';
|
||||
|
||||
/**
|
||||
* Splits `string` by `separator`.
|
||||
*
|
||||
* **Note:** This method is based on [`String#split`](https://mdn.io/String/split).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to split.
|
||||
* @param {RegExp|string} separator The separator pattern to split by.
|
||||
* @param {number} [limit] The length to truncate results to.
|
||||
* @returns {Array} Returns the new array of string segments.
|
||||
* @example
|
||||
*
|
||||
* _.split('a-b-c', '-', 2);
|
||||
* // => ['a', 'b']
|
||||
*/
|
||||
function split(string, separator, limit) {
|
||||
return toString(string).split(separator, limit);
|
||||
}
|
||||
|
||||
export default split;
|
||||
Reference in New Issue
Block a user