summaryrefslogtreecommitdiff
path: root/src/node_util.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-01-27 22:01:32 +0100
committerAnna Henningsen <anna@addaleax.net>2018-03-05 17:41:26 +0000
commitb20af8088a4d5cccb1901d42107f6d9ca82d306f (patch)
treed443fa727be877dc7ad6e4112503944a8e674490 /src/node_util.cc
parentbd6e0be0dfbbf6d10f1f054c43b0b82f25c60b16 (diff)
downloadandroid-node-v8-b20af8088a4d5cccb1901d42107f6d9ca82d306f.tar.gz
android-node-v8-b20af8088a4d5cccb1901d42107f6d9ca82d306f.tar.bz2
android-node-v8-b20af8088a4d5cccb1901d42107f6d9ca82d306f.zip
util: introduce `util.types.is[…]` type checks
Provide public APIs for native typechecking that is actually useful. The motivation for this is providing alternatives to userland modules that would currently rely on `process.binding('util')`. PR-URL: https://github.com/nodejs/node/pull/18415 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Diffstat (limited to 'src/node_util.cc')
-rw-r--r--src/node_util.cc40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/node_util.cc b/src/node_util.cc
index 1542b533f3..662809fb85 100644
--- a/src/node_util.cc
+++ b/src/node_util.cc
@@ -17,40 +17,6 @@ using v8::Proxy;
using v8::String;
using v8::Value;
-
-#define VALUE_METHOD_MAP(V) \
- V(isArrayBuffer, IsArrayBuffer) \
- V(isArrayBufferView, IsArrayBufferView) \
- V(isAsyncFunction, IsAsyncFunction) \
- V(isDataView, IsDataView) \
- V(isDate, IsDate) \
- V(isExternal, IsExternal) \
- V(isMap, IsMap) \
- V(isMapIterator, IsMapIterator) \
- V(isNativeError, IsNativeError) \
- V(isPromise, IsPromise) \
- V(isRegExp, IsRegExp) \
- V(isSet, IsSet) \
- V(isSetIterator, IsSetIterator) \
- V(isTypedArray, IsTypedArray) \
- V(isUint8Array, IsUint8Array)
-
-
-#define V(_, ucname) \
- static void ucname(const FunctionCallbackInfo<Value>& args) { \
- CHECK_EQ(1, args.Length()); \
- args.GetReturnValue().Set(args[0]->ucname()); \
- }
-
- VALUE_METHOD_MAP(V)
-#undef V
-
-static void IsAnyArrayBuffer(const FunctionCallbackInfo<Value>& args) {
- CHECK_EQ(1, args.Length());
- args.GetReturnValue().Set(
- args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer());
-}
-
static void GetPromiseDetails(const FunctionCallbackInfo<Value>& args) {
// Return undefined if it's not a Promise.
if (!args[0]->IsPromise())
@@ -191,12 +157,6 @@ void Initialize(Local<Object> target,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);
-#define V(lcname, ucname) env->SetMethod(target, #lcname, ucname);
- VALUE_METHOD_MAP(V)
-#undef V
-
- env->SetMethod(target, "isAnyArrayBuffer", IsAnyArrayBuffer);
-
#define V(name, _) \
target->Set(context, \
FIXED_ONE_BYTE_STRING(env->isolate(), #name), \