|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
570 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 | * Returns script url and its global variable.
|
|---|
| 10 | * @param {string} urlAndGlobal the script request
|
|---|
| 11 | * @returns {string[]} script url and its global variable
|
|---|
| 12 | */
|
|---|
| 13 | module.exports = function extractUrlAndGlobal(urlAndGlobal) {
|
|---|
| 14 | const index = urlAndGlobal.indexOf("@");
|
|---|
| 15 | if (index <= 0 || index === urlAndGlobal.length - 1) {
|
|---|
| 16 | throw new Error(`Invalid request "${urlAndGlobal}"`);
|
|---|
| 17 | }
|
|---|
| 18 | return [urlAndGlobal.slice(index + 1), urlAndGlobal.slice(0, index)];
|
|---|
| 19 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.