@purescraps/purehtml 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/simple.js +35 -0
- package/dist/examples/simple.js.map +1 -1
- package/dist/src/index.js +35 -0
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/dist/examples/simple.js
CHANGED
|
@@ -6753,6 +6753,40 @@ var NumberTransformer = class extends Transformer {
|
|
|
6753
6753
|
}
|
|
6754
6754
|
};
|
|
6755
6755
|
|
|
6756
|
+
// src/transformers/remove-url-query-param.ts
|
|
6757
|
+
var RemoveUrlQueryParam = class _RemoveUrlQueryParam extends Transformer {
|
|
6758
|
+
constructor(args) {
|
|
6759
|
+
super();
|
|
6760
|
+
this.args = args;
|
|
6761
|
+
}
|
|
6762
|
+
static transformerName = "removeUrlQueryParam";
|
|
6763
|
+
static getName() {
|
|
6764
|
+
return _RemoveUrlQueryParam.transformerName;
|
|
6765
|
+
}
|
|
6766
|
+
inputType() {
|
|
6767
|
+
return STRING;
|
|
6768
|
+
}
|
|
6769
|
+
outputType() {
|
|
6770
|
+
return STRING;
|
|
6771
|
+
}
|
|
6772
|
+
transform({
|
|
6773
|
+
val
|
|
6774
|
+
}) {
|
|
6775
|
+
const { args } = this;
|
|
6776
|
+
if (typeof val !== "string") {
|
|
6777
|
+
throw new Error(
|
|
6778
|
+
`${_RemoveUrlQueryParam.transformerName}: expected string. Got ${JSON.stringify(
|
|
6779
|
+
val
|
|
6780
|
+
)}`
|
|
6781
|
+
);
|
|
6782
|
+
}
|
|
6783
|
+
if (args.length === 0) return val;
|
|
6784
|
+
const url = new URL(val);
|
|
6785
|
+
args.forEach((paramName) => url.searchParams.delete(paramName));
|
|
6786
|
+
return url.toString();
|
|
6787
|
+
}
|
|
6788
|
+
};
|
|
6789
|
+
|
|
6756
6790
|
// src/transformers/resolve.ts
|
|
6757
6791
|
var ResolveTransformer = class extends Transformer {
|
|
6758
6792
|
static getName() {
|
|
@@ -6849,6 +6883,7 @@ var Transformers = class {
|
|
|
6849
6883
|
JSONTransformer,
|
|
6850
6884
|
Length,
|
|
6851
6885
|
NumberTransformer,
|
|
6886
|
+
RemoveUrlQueryParam,
|
|
6852
6887
|
ResolveTransformer,
|
|
6853
6888
|
Trim,
|
|
6854
6889
|
UrlQueryParamTransformer
|