main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
746 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
---|
| 4 | exports.__esModule = true;
|
---|
| 5 | exports.default = void 0;
|
---|
| 6 | var _escape = _interopRequireDefault(require("./escape.cjs"));
|
---|
| 7 | var _CompilationJsonPointerError = _interopRequireDefault(require("./errors/CompilationJsonPointerError.cjs"));
|
---|
| 8 | // compile :: String[] -> String
|
---|
| 9 | const compile = tokens => {
|
---|
| 10 | try {
|
---|
| 11 | if (tokens.length === 0) {
|
---|
| 12 | return '';
|
---|
| 13 | }
|
---|
| 14 | return `/${tokens.map(_escape.default).join('/')}`;
|
---|
| 15 | } catch (error) {
|
---|
| 16 | throw new _CompilationJsonPointerError.default('JSON Pointer compilation of tokens encountered an error.', {
|
---|
| 17 | tokens,
|
---|
| 18 | cause: error
|
---|
| 19 | });
|
---|
| 20 | }
|
---|
| 21 | };
|
---|
| 22 | var _default = exports.default = compile; |
---|
Note:
See
TracBrowser
for help on using the repository browser.