MCPcopy Create free account
hub / github.com/apache/thrift / number

Function number

lib/nodejs/lib/thrift/json_parse.js:68–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66 return ch;
67 },
68 number = function () {
69 // Parse a number value.
70
71 var number,
72 string = "";
73
74 if (ch === "-") {
75 string = "-";
76 next("-");
77 }
78 while (ch >= "0" && ch <= "9") {
79 string += ch;
80 next();
81 }
82 if (ch === ".") {
83 string += ".";
84 while (next() && ch >= "0" && ch <= "9") {
85 string += ch;
86 }
87 }
88 if (ch === "e" || ch === "E") {
89 string += ch;
90 next();
91 if (ch === "-" || ch === "+") {
92 string += ch;
93 next();
94 }
95 while (ch >= "0" && ch <= "9") {
96 string += ch;
97 next();
98 }
99 }
100 number = +string;
101 if (!isFinite(number)) {
102 error("Bad number");
103 } else if (number >= Int64.MAX_INT || number <= Int64.MIN_INT) {
104 // Return raw string for further process in TJSONProtocol
105 return string;
106 } else {
107 return number;
108 }
109 },
110 string = function () {
111 // Parse a string value.
112

Callers 1

json_parse.jsFile · 0.85

Calls 2

nextFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected