+0
-43
@@ -169,43 +169,2 @@ #include <assert.h> | ||
| static js_value_t * | ||
| bare_url_tag (js_env_t *env, js_callback_info_t *info) { | ||
| int err; | ||
| size_t argc = 1; | ||
| js_value_t *argv[1]; | ||
| err = js_get_callback_info(env, info, &argc, argv, NULL, NULL); | ||
| assert(err == 0); | ||
| assert(argc == 1); | ||
| err = js_add_type_tag(env, argv[0], &bare_url__tag); | ||
| assert(err == 0); | ||
| return NULL; | ||
| } | ||
| static js_value_t * | ||
| bare_url_is_tagged (js_env_t *env, js_callback_info_t *info) { | ||
| int err; | ||
| size_t argc = 1; | ||
| js_value_t *argv[1]; | ||
| err = js_get_callback_info(env, info, &argc, argv, NULL, NULL); | ||
| assert(err == 0); | ||
| assert(argc == 1); | ||
| bool is_url; | ||
| err = js_check_type_tag(env, argv[0], &bare_url__tag, &is_url); | ||
| assert(err == 0); | ||
| js_value_t *result; | ||
| err = js_get_boolean(env, is_url, &result); | ||
| assert(err == 0); | ||
| return result; | ||
| } | ||
| static js_value_t * | ||
| bare_url_exports (js_env_t *env, js_value_t *exports) { | ||
@@ -225,4 +184,2 @@ int err; | ||
| V("canParse", bare_url_can_parse) | ||
| V("tag", bare_url_tag) | ||
| V("isTagged", bare_url_is_tagged) | ||
| #undef V | ||
@@ -229,0 +186,0 @@ |
+12
-12
@@ -5,7 +5,9 @@ const path = require('bare-path') | ||
| const kind = Symbol.for('bare.url.kind') | ||
| const isWindows = Bare.platform === 'win32' | ||
| module.exports = exports = class URL { | ||
| static { | ||
| binding.tag(this) | ||
| static get [kind]() { | ||
| return 0 // Compatibility version | ||
| } | ||
@@ -25,2 +27,6 @@ | ||
| get [kind]() { | ||
| return URL[kind] | ||
| } | ||
| // https://url.spec.whatwg.org/#dom-url-href | ||
@@ -282,13 +288,7 @@ | ||
| exports.isURL = function isURL(value) { | ||
| if (typeof value !== 'object' || value === null) return false | ||
| if (value instanceof URL) return true | ||
| let constructor = value.constructor | ||
| while (typeof constructor === 'function') { | ||
| if (binding.isTagged(constructor)) return true | ||
| constructor = Reflect.getPrototypeOf(constructor) | ||
| } | ||
| return false | ||
| return ( | ||
| typeof value === 'object' && value !== null && value[kind] === URL[kind] | ||
| ) | ||
| } | ||
@@ -295,0 +295,0 @@ |
+1
-1
| { | ||
| "name": "bare-url", | ||
| "version": "2.1.5", | ||
| "version": "2.1.6", | ||
| "description": "WHATWG URL implementation for JavaScript", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
361
0.28%1205367
-0.77%