MCPcopy Create free account
hub / github.com/TruthHun/BookStack / isNumber

Function isNumber

static/editor.md/lib/codemirror/mode/clojure/clojure.js:79–110  ·  view source on GitHub ↗
(ch, stream)

Source from the content-addressed store, hash-verified

77 }
78
79 function isNumber(ch, stream){
80 // hex
81 if ( ch === '0' && stream.eat(/x/i) ) {
82 stream.eatWhile(tests.hex);
83 return true;
84 }
85
86 // leading sign
87 if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
88 stream.eat(tests.sign);
89 ch = stream.next();
90 }
91
92 if ( tests.digit.test(ch) ) {
93 stream.eat(ch);
94 stream.eatWhile(tests.digit);
95
96 if ( '.' == stream.peek() ) {
97 stream.eat('.');
98 stream.eatWhile(tests.digit);
99 }
100
101 if ( stream.eat(tests.exponent) ) {
102 stream.eat(tests.sign);
103 stream.eatWhile(tests.digit);
104 }
105
106 return true;
107 }
108
109 return false;
110 }
111
112 // Eat character that starts after backslash \
113 function eatCharacter(stream) {

Callers 1

clojure.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected