aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/split-on-first/index.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2019-07-24 23:00:03 -0700
committerMichaƫl Zasso <targos@protonmail.com>2019-08-06 09:05:32 +0200
commitd7d321b071789f08c65dbb11a0e4b3b6a299af44 (patch)
tree1015b8c5da3632fc986b56051a4853ac946c56f4 /deps/npm/node_modules/split-on-first/index.js
parent37d27486fce50bd82b6b5095af880d435ed308f8 (diff)
downloadandroid-node-v8-d7d321b071789f08c65dbb11a0e4b3b6a299af44.tar.gz
android-node-v8-d7d321b071789f08c65dbb11a0e4b3b6a299af44.tar.bz2
android-node-v8-d7d321b071789f08c65dbb11a0e4b3b6a299af44.zip
deps: upgrade npm to 6.10.2
PR-URL: https://github.com/nodejs/node/pull/28853 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/split-on-first/index.js')
-rw-r--r--deps/npm/node_modules/split-on-first/index.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/deps/npm/node_modules/split-on-first/index.js b/deps/npm/node_modules/split-on-first/index.js
new file mode 100644
index 0000000000..d9140706dd
--- /dev/null
+++ b/deps/npm/node_modules/split-on-first/index.js
@@ -0,0 +1,22 @@
+'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)
+ ];
+};