src/helper.js
function (delimiter, string, limit) {

            if (arguments.length < 2 ||
                typeof delimiter === "undefined" ||
                typeof string === "undefined"
            ) {
                return null;
            }

            if (delimiter === "" ||
                delimiter === false ||
                delimiter === null
            ) {
                return false;
            }

            if (delimiter === true) {
                delimiter = "1";
            }

            // Here we go...
            delimiter += "";
            string += "";

            var splited = string.split(delimiter);

            if (typeof limit === "undefined") {
                return splited;
            }

            // Support for limit
            if (limit === 0) {
                limit = 1;
            }

            // Positive limit
            if (limit > 0) {
                if (limit >= splited.length) {
                    return splited;
                }

                return splited.slice(0, limit - 1)
                    .concat([splited.slice(limit - 1)
                        .join(delimiter)
                    ]);
            }

            // Negative limit
            if (-limit >= splited.length) {
                return [];
            }

            splited.splice(splited.length + limit);

            return splited;
        }
function (delimiter, string, limit) {

            if (arguments.length < 2 ||
                typeof delimiter === "undefined" ||
                typeof string === "undefined"
            ) {
                return null;
            }

            if (delimiter === "" ||
                delimiter === false ||
                delimiter === null
            ) {
                return false;
            }

            if (delimiter === true) {
                delimiter = "1";
            }

            // Here we go...
            delimiter += "";
            string += "";

            var splited = string.split(delimiter);

            if (typeof limit === "undefined") {
                return splited;
            }

            // Support for limit
            if (limit === 0) {
                limit = 1;
            }

            // Positive limit
            if (limit > 0) {
                if (limit >= splited.length) {
                    return splited;
                }

                return splited.slice(0, limit - 1)
                    .concat([splited.slice(limit - 1)
                        .join(delimiter)
                    ]);
            }

            // Negative limit
            if (-limit >= splited.length) {
                return [];
            }

            splited.splice(splited.length + limit);

            return splited;
        }
function ( delimiter , string , limit ) { if ( arguments . length < 2 || typeof delimiter === "undefined" || typeof string === "undefined" ) { return null ; } if ( delimiter === "" || delimiter === false || delimiter === null ) { return false ; } if ( delimiter === true ) { delimiter = "1" ; } // Here we go... delimiter += "" ; string += "" ; var splited = string . split ( delimiter ) ; if ( typeof limit === "undefined" ) { return splited ; } // Support for limit if ( limit === 0 ) { limit = 1 ; } // Positive limit if ( limit > 0 ) { if ( limit >= splited . length ) { return splited ; } return splited . slice ( 0 , limit - 1 ) . concat ( [ splited . slice ( limit - 1 ) . join ( delimiter ) ] ) ; } // Negative limit if ( - limit >= splited . length ) { return [ ] ; } splited . splice ( splited . length + limit ) ; return splited ; }
Split a string by string

@link http://phpjs.org/functions/explode/
@link http://php.net/manual/en/function.explode.php

@param delimiter
@param string
@param limit
@returns {*}
Split a string by string