-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
format: stop relying on array properties #131
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,7 +377,7 @@ var UNITS = { | |
"<oersted>" : [["Oe","oersted","oersteds"], 250.0 / Math.PI, "magnetism", ["<ampere>"], ["<meter>"]], | ||
|
||
/* energy */ | ||
"<joule>" : [["J","joule","Joule","joules"], 1.0, "energy", ["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]], | ||
"<joule>" : [["J","joule","Joule","joules","Joules"], 1.0, "energy", ["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]], | ||
"<erg>" : [["erg","ergs"], 1e-7, "energy", ["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]], | ||
"<btu>" : [["BTU","btu","BTUs"], 1055.056, "energy", ["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]], | ||
"<calorie>" : [["cal","calorie","calories"], 4.18400, "energy",["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]], | ||
|
@@ -454,7 +454,9 @@ var UNITS = { | |
"<dozen>" : [["doz","dz","dozen"],12.0,"prefix_only", ["<each>"]], | ||
"<percent>": [["%","percent"], 0.01, "prefix_only", ["<1>"]], | ||
"<ppm>" : [["ppm"],1e-6, "prefix_only", ["<1>"]], | ||
"<ppt>" : [["ppt"],1e-9, "prefix_only", ["<1>"]], | ||
"<ppb>" : [["ppb"],1e-9, "prefix_only", ["<1>"]], | ||
"<ppt>" : [["ppt"],1e-12, "prefix_only", ["<1>"]], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another ambiguous term: parts per trillion or parts per thousand? (and if trillion: US trillion or UK trillion) |
||
"<ppq>" : [["ppq"],1e-15, "prefix_only", ["<1>"]], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. quad? quint? |
||
"<gross>" : [["gr","gross"],144.0, "prefix_only", ["<dozen>","<dozen>"]], | ||
"<decibel>" : [["dB","decibel","decibels"], 1.0, "logarithmic", ["<decibel>"]] | ||
}; | ||
|
@@ -1985,10 +1987,13 @@ function getOutputNames(units) { | |
function simplify(units) { | ||
// this turns ['s','m','s'] into ['s2','m'] | ||
|
||
var counters = {}; | ||
var unitCounts = units.reduce(function(acc, unit) { | ||
var unitCounter = acc[unit]; | ||
var unitCounter = counters[unit]; | ||
if (!unitCounter) { | ||
acc.push(unitCounter = acc[unit] = [unit, 0]); | ||
unitCounter = [unit, 0]; | ||
counters[unit] = unitCounter; | ||
acc.push(unitCounter); | ||
} | ||
|
||
unitCounter[1]++; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These (beyond million) only make sense in the places like the US where 1 billion == 1 thousand million, not in places like the UK where 1 billion == 1 million million.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ignore the generated files. I did not write this code, but they weren't .gitignored so I felt like I should include them. If you think there are issues here, you might consider logging one since these things were already here.