Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8145)

Unified Diff: chrome/common/extensions/docs/js/api_page_generator.js

Issue 9921003: Make the constants in the chrome.storage API actual powers of 2, and comma- (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/api/storage.json ('k') | chrome/common/extensions/docs/storage.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/js/api_page_generator.js
diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js
index 8c8322f557afe450fc914b154835dfa60f0b99a0..4f8c95ed8e94b61673144b8611055dc271dbb064 100644
--- a/chrome/common/extensions/docs/js/api_page_generator.js
+++ b/chrome/common/extensions/docs/js/api_page_generator.js
@@ -652,10 +652,21 @@ function hasPrimitiveValue(schema) {
}
function getPrimitiveValue(schema) {
- if (schema.type === 'string')
+ if (schema.type === 'string') {
return '"' + schema.value + '"';
- else
+ } else if (schema.type === 'integer') {
+ // Comma-separate large numbers (e.g. 5,000,000), easier to read.
+ var value = String(schema.value);
+ var groupsOfThree = [];
+ while (value.length > 3) {
+ groupsOfThree.unshift(value.slice(value.length - 3));
+ value = value.slice(0, value.length - 3);
+ }
+ groupsOfThree.unshift(value);
+ return groupsOfThree.join(',');
+ } else {
return schema.value;
+ }
}
function getSignatureString(parameters) {
« no previous file with comments | « chrome/common/extensions/api/storage.json ('k') | chrome/common/extensions/docs/storage.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698