Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
libre
marka
Commits
35a76333
Commit
35a76333
authored
Jan 27, 2016
by
Christopher Guess
Browse files
added lookup for multipliers (thousand, hundred, score etc.)
parent
ca1d9512
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
js/marka.js
js/marka.js
+6
-3
No files found.
js/marka.js
View file @
35a76333
...
...
@@ -45,7 +45,7 @@ Marka.prototype.match = function() {
var
currencyWords
=
"
(
"
+
currencySymbols
+
"
|kr|[Dd]ollars|[Cc]ents on the dollar|[Cc]ents|[Ee]uros|[Pp]ounds|[Rr]upees|[Zz]loty)
"
;
var
numbers
=
"
[
\\
d,.]+
"
;
var
optSpace
=
"
[
\\
s]*
"
;
var
magnitudes
=
"
([Mm]illion|[Bb]illion|
h
undred
t
housand){0,1}
"
;
var
magnitudes
=
"
([Mm]illion|[Bb]illion|
[Hh]
undred
|[Tt]
housand
|[Tt]rillion|[Ll]akh|[Cc]rore|[Ss]core
){0,1}
"
;
var
currencyCode
=
"
[A-Z]{2,3}
"
;
var
optAsterisk
=
"
[*]{0,1}
"
;
var
optBraceOpen
=
"
[
\
(]{0,1}
"
;
...
...
@@ -98,12 +98,15 @@ Marka.prototype.splitSymbols = function(text) {
realnumber
=
parseFloat
(
number
);
if
(
!
realnumber
)
{
return
false
;
}
var
residual
=
text
.
replace
(
numbers
,
""
)
$
.
each
(
dollar_multiplier_lookup_table
,
function
(
property
,
value
){
for
(
var
property
in
dollar_multiplier_lookup_table
){
value
=
dollar_multiplier_lookup_table
[
property
];
var
index
=
residual
.
search
(
property
);
if
(
index
>
-
1
){
realnumber
=
realnumber
*
value
;
residual
=
residual
.
replace
(
property
,
""
);
}
});
};
var
result
=
this
.
findSymbol
(
residual
);
if
(
result
.
symbol
==
null
)
{
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment