bare-url 2.1.5 → 2.1.6
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/binding.c +0 -43
- package/index.js +12 -12
- package/package.json +1 -1
- package/prebuilds/android-arm/bare-url.bare +0 -0
- package/prebuilds/android-arm64/bare-url.bare +0 -0
- package/prebuilds/android-ia32/bare-url.bare +0 -0
- package/prebuilds/android-x64/bare-url.bare +0 -0
- package/prebuilds/darwin-arm64/bare-url.bare +0 -0
- package/prebuilds/darwin-x64/bare-url.bare +0 -0
- package/prebuilds/ios-arm64/bare-url.bare +0 -0
- package/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
- package/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
- package/prebuilds/linux-arm64/bare-url.bare +0 -0
- package/prebuilds/linux-x64/bare-url.bare +0 -0
- package/prebuilds/win32-arm64/bare-url.bare +0 -0
- package/prebuilds/win32-x64/bare-url.bare +0 -0
package/binding.c
CHANGED
|
@@ -165,47 +165,6 @@ bare_url_can_parse (js_env_t *env, js_callback_info_t *info) {
|
|
|
165
165
|
return result;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
static js_value_t *
|
|
169
|
-
bare_url_tag (js_env_t *env, js_callback_info_t *info) {
|
|
170
|
-
int err;
|
|
171
|
-
|
|
172
|
-
size_t argc = 1;
|
|
173
|
-
js_value_t *argv[1];
|
|
174
|
-
|
|
175
|
-
err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
|
|
176
|
-
assert(err == 0);
|
|
177
|
-
|
|
178
|
-
assert(argc == 1);
|
|
179
|
-
|
|
180
|
-
err = js_add_type_tag(env, argv[0], &bare_url__tag);
|
|
181
|
-
assert(err == 0);
|
|
182
|
-
|
|
183
|
-
return NULL;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
static js_value_t *
|
|
187
|
-
bare_url_is_tagged (js_env_t *env, js_callback_info_t *info) {
|
|
188
|
-
int err;
|
|
189
|
-
|
|
190
|
-
size_t argc = 1;
|
|
191
|
-
js_value_t *argv[1];
|
|
192
|
-
|
|
193
|
-
err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
|
|
194
|
-
assert(err == 0);
|
|
195
|
-
|
|
196
|
-
assert(argc == 1);
|
|
197
|
-
|
|
198
|
-
bool is_url;
|
|
199
|
-
err = js_check_type_tag(env, argv[0], &bare_url__tag, &is_url);
|
|
200
|
-
assert(err == 0);
|
|
201
|
-
|
|
202
|
-
js_value_t *result;
|
|
203
|
-
err = js_get_boolean(env, is_url, &result);
|
|
204
|
-
assert(err == 0);
|
|
205
|
-
|
|
206
|
-
return result;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
168
|
static js_value_t *
|
|
210
169
|
bare_url_exports (js_env_t *env, js_value_t *exports) {
|
|
211
170
|
int err;
|
|
@@ -221,8 +180,6 @@ bare_url_exports (js_env_t *env, js_value_t *exports) {
|
|
|
221
180
|
|
|
222
181
|
V("parse", bare_url_parse)
|
|
223
182
|
V("canParse", bare_url_can_parse)
|
|
224
|
-
V("tag", bare_url_tag)
|
|
225
|
-
V("isTagged", bare_url_is_tagged)
|
|
226
183
|
#undef V
|
|
227
184
|
|
|
228
185
|
return exports;
|
package/index.js
CHANGED
|
@@ -2,11 +2,13 @@ const path = require('bare-path')
|
|
|
2
2
|
const binding = require('./binding')
|
|
3
3
|
const errors = require('./lib/errors')
|
|
4
4
|
|
|
5
|
+
const kind = Symbol.for('bare.url.kind')
|
|
6
|
+
|
|
5
7
|
const isWindows = Bare.platform === 'win32'
|
|
6
8
|
|
|
7
9
|
module.exports = exports = class URL {
|
|
8
|
-
static {
|
|
9
|
-
|
|
10
|
+
static get [kind]() {
|
|
11
|
+
return 0 // Compatibility version
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
constructor(input, base, opts = {}) {
|
|
@@ -21,6 +23,10 @@ module.exports = exports = class URL {
|
|
|
21
23
|
this._parse(input, base, opts.throw !== false)
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
get [kind]() {
|
|
27
|
+
return URL[kind]
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
// https://url.spec.whatwg.org/#dom-url-href
|
|
25
31
|
|
|
26
32
|
get href() {
|
|
@@ -277,17 +283,11 @@ exports.URL = URL // For Node.js compatibility
|
|
|
277
283
|
exports.errors = errors
|
|
278
284
|
|
|
279
285
|
exports.isURL = function isURL(value) {
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
let constructor = value.constructor
|
|
283
|
-
|
|
284
|
-
while (typeof constructor === 'function') {
|
|
285
|
-
if (binding.isTagged(constructor)) return true
|
|
286
|
-
|
|
287
|
-
constructor = Reflect.getPrototypeOf(constructor)
|
|
288
|
-
}
|
|
286
|
+
if (value instanceof URL) return true
|
|
289
287
|
|
|
290
|
-
return
|
|
288
|
+
return (
|
|
289
|
+
typeof value === 'object' && value !== null && value[kind] === URL[kind]
|
|
290
|
+
)
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
exports.parse = function parse(input, base) {
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|