main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
531 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Sam Chen @chenxsan
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * @param {string} urlAndGlobal the script request
|
---|
10 | * @returns {string[]} script url and its global variable
|
---|
11 | */
|
---|
12 | module.exports = function extractUrlAndGlobal(urlAndGlobal) {
|
---|
13 | const index = urlAndGlobal.indexOf("@");
|
---|
14 | if (index <= 0 || index === urlAndGlobal.length - 1) {
|
---|
15 | throw new Error(`Invalid request "${urlAndGlobal}"`);
|
---|
16 | }
|
---|
17 | return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)];
|
---|
18 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.