frontend/.pnpm-store/v3/files/7b/daa132b4bafe8b95e4f4dda95eb8233273652a6836b6e1b5719f9e4d215643505ca1f5be6b5542104217f8c468f3d48e352e8661261600e51f561c3fd30b4e

23 lines
459 B
Plaintext

'use strict';
module.exports = (string, separator) => {
if (!(typeof string === 'string' && typeof separator === 'string')) {
throw new TypeError('Expected the arguments to be of type `string`');
}
if (separator === '') {
return [string];
}
const separatorIndex = string.indexOf(separator);
if (separatorIndex === -1) {
return [string];
}
return [
string.slice(0, separatorIndex),
string.slice(separatorIndex + separator.length)
];
};