main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
615 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | /*
|
---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
| 3 | Author Ivan Kopeykin @vankop
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | "use strict";
|
---|
| 7 |
|
---|
| 8 | const PATH_QUERY_FRAGMENT_REGEXP =
|
---|
| 9 | /^(#?(?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * @param {string} identifier identifier
|
---|
| 13 | * @returns {[string, string, string]|null} parsed identifier
|
---|
| 14 | */
|
---|
| 15 | function parseIdentifier(identifier) {
|
---|
| 16 | const match = PATH_QUERY_FRAGMENT_REGEXP.exec(identifier);
|
---|
| 17 |
|
---|
| 18 | if (!match) return null;
|
---|
| 19 |
|
---|
| 20 | return [
|
---|
| 21 | match[1].replace(/\0(.)/g, "$1"),
|
---|
| 22 | match[2] ? match[2].replace(/\0(.)/g, "$1") : "",
|
---|
| 23 | match[3] || ""
|
---|
| 24 | ];
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | module.exports.parseIdentifier = parseIdentifier;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.