@xo-union/url-template
Advanced tools
Comparing version 2.0.4 to 2.0.5
"use strict"; | ||
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property"); | ||
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault"); | ||
_Object$defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/weak-map")); | ||
var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classPrivateFieldGet")); | ||
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classPrivateFieldSet")); | ||
var _url = require("url"); | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } | ||
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } | ||
var _templateString = /*#__PURE__*/new _weakMap.default(); | ||
var _variables = /*#__PURE__*/new _weakMap.default(); | ||
var _replacer = /*#__PURE__*/new _weakMap.default(); | ||
class UrlTemplate { | ||
@@ -37,3 +24,2 @@ constructor(templateString, variables) { | ||
}); | ||
_classPrivateFieldInitSpec(this, _variables, { | ||
@@ -43,3 +29,2 @@ writable: true, | ||
}); | ||
_classPrivateFieldInitSpec(this, _replacer, { | ||
@@ -51,15 +36,11 @@ writable: true, | ||
} | ||
throw new Error(`Unspecified template variable: ${capture}`); | ||
} | ||
}); | ||
(0, _classPrivateFieldSet2.default)(this, _templateString, templateString); | ||
(0, _classPrivateFieldSet2.default)(this, _variables, variables); | ||
} | ||
set(key, value) { | ||
(0, _classPrivateFieldGet2.default)(this, _variables)[key] = value; | ||
} | ||
toString() { | ||
@@ -70,9 +51,6 @@ const url = (0, _url.parse)((0, _classPrivateFieldGet2.default)(this, _templateString)); | ||
} | ||
toJSON() { | ||
return this.toString(); | ||
} | ||
} | ||
exports.default = UrlTemplate; |
import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/esm/classPrivateFieldGet"; | ||
import _classPrivateFieldSet from "@babel/runtime-corejs3/helpers/esm/classPrivateFieldSet"; | ||
import _WeakMap from "@babel/runtime-corejs3/core-js/weak-map"; | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } | ||
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } | ||
import { parse, format } from "url"; | ||
var _templateString = /*#__PURE__*/new _WeakMap(); | ||
var _variables = /*#__PURE__*/new _WeakMap(); | ||
var _replacer = /*#__PURE__*/new _WeakMap(); | ||
export default class UrlTemplate { | ||
@@ -23,3 +16,2 @@ constructor(templateString, variables) { | ||
}); | ||
_classPrivateFieldInitSpec(this, _variables, { | ||
@@ -29,3 +21,2 @@ writable: true, | ||
}); | ||
_classPrivateFieldInitSpec(this, _replacer, { | ||
@@ -37,16 +28,11 @@ writable: true, | ||
} | ||
throw new Error(`Unspecified template variable: ${capture}`); | ||
} | ||
}); | ||
_classPrivateFieldSet(this, _templateString, templateString); | ||
_classPrivateFieldSet(this, _variables, variables); | ||
} | ||
set(key, value) { | ||
_classPrivateFieldGet(this, _variables)[key] = value; | ||
} | ||
toString() { | ||
@@ -57,7 +43,5 @@ const url = parse(_classPrivateFieldGet(this, _templateString)); | ||
} | ||
toJSON() { | ||
return this.toString(); | ||
} | ||
} |
{ | ||
"name": "@xo-union/url-template", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"sideEffects": false, | ||
@@ -18,3 +18,3 @@ "main": "lib/index.cjs.js", | ||
"devDependencies": { | ||
"@xo-union/packager": "^6.1.3", | ||
"@xo-union/packager": "^6.1.4", | ||
"@xo-union/pkg-validator": "^3.2.2" | ||
@@ -28,3 +28,3 @@ }, | ||
}, | ||
"gitHead": "f32e1fa39baa025d36505f5d9f361009e6bf2df6" | ||
"gitHead": "607f1f1a860a43541901729546ad8300b3d8f4d3" | ||
} |
15346