Permalink
Browse files

util, feat: support bigint in util.format.

  • Loading branch information...
xicilion committed Apr 27, 2018
1 parent c0fa624 commit da53123a8def7b5ab36d01d9612726ec3d342bb9
Showing with 4 additions and 1 deletion.
  1. +4 −1 fibjs/src/util/util_format.cpp
@@ -76,7 +76,10 @@ exlib::string json_format(v8::Local<v8::Value> obj)
strBuffer.append(*v8::String::Utf8Value(v));
else if (v->IsNumber() || v->IsNumberObject())
strBuffer.append(*v8::String::Utf8Value(v->ToNumber(_context).ToLocalChecked()));
else if (v->IsString() || v->IsStringObject())
else if (v->IsBigInt() || v->IsBigIntObject()) {
strBuffer.append(*v8::String::Utf8Value(v->ToBigInt(_context).ToLocalChecked()));
strBuffer.append('n');
} else if (v->IsString() || v->IsStringObject())
string_format(strBuffer, v);
else if (v->IsRegExp()) {
v8::Local<v8::RegExp> re = v8::Local<v8::RegExp>::Cast(v);

0 comments on commit da53123

Please sign in to comment.