init
This commit is contained in:
1
node_modules/matrix-widget-api/lib/models/validation/url.d.ts
generated
vendored
Normal file
1
node_modules/matrix-widget-api/lib/models/validation/url.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function isValidUrl(val: string): boolean;
|
||||
39
node_modules/matrix-widget-api/lib/models/validation/url.js
generated
vendored
Normal file
39
node_modules/matrix-widget-api/lib/models/validation/url.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isValidUrl = isValidUrl;
|
||||
/*
|
||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function isValidUrl(val) {
|
||||
if (!val) return false; // easy: not valid if not present
|
||||
|
||||
try {
|
||||
var parsed = new URL(val);
|
||||
if (parsed.protocol !== "http" && parsed.protocol !== "https") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=url.js.map
|
||||
1
node_modules/matrix-widget-api/lib/models/validation/url.js.map
generated
vendored
Normal file
1
node_modules/matrix-widget-api/lib/models/validation/url.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"url.js","names":["isValidUrl","val","parsed","URL","protocol","e","TypeError"],"sources":["../../../src/models/validation/url.ts"],"sourcesContent":["/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isValidUrl(val: string): boolean {\n if (!val) return false; // easy: not valid if not present\n\n try {\n const parsed = new URL(val);\n if (parsed.protocol !== \"http\" && parsed.protocol !== \"https\") {\n return false;\n }\n return true;\n } catch (e) {\n if (e instanceof TypeError) {\n return false;\n }\n throw e;\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASA,UAAUA,CAACC,GAAW,EAAW;EAC7C,IAAI,CAACA,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC;;EAExB,IAAI;IACA,IAAMC,MAAM,GAAG,IAAIC,GAAG,CAACF,GAAG,CAAC;IAC3B,IAAIC,MAAM,CAACE,QAAQ,KAAK,MAAM,IAAIF,MAAM,CAACE,QAAQ,KAAK,OAAO,EAAE;MAC3D,OAAO,KAAK;IAChB;IACA,OAAO,IAAI;EACf,CAAC,CAAC,OAAOC,CAAC,EAAE;IACR,IAAIA,CAAC,YAAYC,SAAS,EAAE;MACxB,OAAO,KAAK;IAChB;IACA,MAAMD,CAAC;EACX;AACJ","ignoreList":[]}
|
||||
1
node_modules/matrix-widget-api/lib/models/validation/utils.d.ts
generated
vendored
Normal file
1
node_modules/matrix-widget-api/lib/models/validation/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function assertPresent<O extends Record<any, any>>(obj: O, key: keyof O): void;
|
||||
29
node_modules/matrix-widget-api/lib/models/validation/utils.js
generated
vendored
Normal file
29
node_modules/matrix-widget-api/lib/models/validation/utils.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.assertPresent = assertPresent;
|
||||
/*
|
||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function assertPresent(obj, key) {
|
||||
if (!obj[key]) {
|
||||
throw new Error("".concat(String(key), " is required"));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/matrix-widget-api/lib/models/validation/utils.js.map
generated
vendored
Normal file
1
node_modules/matrix-widget-api/lib/models/validation/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","names":["assertPresent","obj","key","Error","concat","String"],"sources":["../../../src/models/validation/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function assertPresent<O extends Record<any, any>>(obj: O, key: keyof O): void {\n if (!obj[key]) {\n throw new Error(`${String(key)} is required`);\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO,SAASA,aAAaA,CAA6BC,GAAM,EAAEC,GAAY,EAAQ;EAClF,IAAI,CAACD,GAAG,CAACC,GAAG,CAAC,EAAE;IACX,MAAM,IAAIC,KAAK,IAAAC,MAAA,CAAIC,MAAM,CAACH,GAAG,CAAC,iBAAc,CAAC;EACjD;AACJ","ignoreList":[]}
|
||||
Reference in New Issue
Block a user