mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 09:06:21 +01:00
change NumberInt.tojson
This commit is contained in:
parent
2116b44647
commit
8113df798d
@ -990,18 +990,24 @@ zzz
|
|||||||
|
|
||||||
JSBool numberint_tostring(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
|
JSBool numberint_tostring(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
|
||||||
Convertor c(cx);
|
Convertor c(cx);
|
||||||
stringstream ss;
|
|
||||||
int val = c.toNumberInt( obj );
|
int val = c.toNumberInt( obj );
|
||||||
ss << "NumberInt(" << val << ")";
|
string ret = str::stream() << "NumberInt(" << val << ")";
|
||||||
|
|
||||||
string ret = ss.str();
|
|
||||||
return *rval = c.toval( ret.c_str() );
|
return *rval = c.toval( ret.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSBool numberint_tojson(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
|
||||||
|
Convertor c(cx);
|
||||||
|
int val = c.toNumberInt( obj );
|
||||||
|
string ret = str::stream() << val;
|
||||||
|
return *rval = c.toval( ret.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JSFunctionSpec numberint_functions[] = {
|
JSFunctionSpec numberint_functions[] = {
|
||||||
{ "valueOf" , numberint_valueof , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
|
{ "valueOf" , numberint_valueof , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
|
||||||
{ "toNumber" , numberint_tonumber , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
|
{ "toNumber" , numberint_tonumber , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
|
||||||
{ "toString" , numberint_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
|
{ "toString" , numberint_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
|
||||||
|
{ "tojson" , numberint_tojson , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user