cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From audre...@apache.org
Subject [4/4] cordova-plugin-globalization git commit: CB-12895 : added eslint and removed jshint
Date Mon, 07 Aug 2017 16:21:18 GMT
CB-12895 : added eslint and removed jshint


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/commit/86e33d3f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/tree/86e33d3f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/diff/86e33d3f

Branch: refs/heads/master
Commit: 86e33d3f7fe3c65ff14711f36d2ab1443279a191
Parents: e9a2b17
Author: Audrey So <audreyso@apache.org>
Authored: Mon Jun 12 10:26:46 2017 -0700
Committer: Audrey So <audreyso@apache.org>
Committed: Thu Aug 3 11:35:42 2017 -0700

----------------------------------------------------------------------
 .eslintignore                       |    1 +
 .eslintrc.yml                       |   10 +
 .jshintignore                       |    1 -
 .jshintrc                           |   16 -
 package.json                        |   12 +-
 src/blackberry10/index.js           |  147 +-
 src/browser/GlobalizationProxy.js   |  204 +--
 src/firefoxos/GlobalizationProxy.js |  221 ++-
 src/tizen/GlobalizationProxy.js     |  140 +-
 src/windows/GlobalizationProxy.js   |  112 +-
 tests/tests.js                      |  154 +-
 www/GlobalizationError.js           |    3 +-
 www/firefoxos/l10n.js               | 2789 +++++++++++++++---------------
 www/firefoxos/l10n_date.js          |  302 ++--
 www/globalization.js                |  663 ++++---
 www/ubuntu/globalization.js         |   99 +-
 16 files changed, 2403 insertions(+), 2471 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/.eslintignore
----------------------------------------------------------------------
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..2ef22fc
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1 @@
+www/browser/moment.js

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..0cccb8c
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+  indent:
+    - error
+    - 4
+  camelcase: off
+  padded-blocks: off
+  operator-linebreak: off
+  no-throw-literal: off
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/.jshintignore
----------------------------------------------------------------------
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index 2ef22fc..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1 +0,0 @@
-www/browser/moment.js

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index cf48aac..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-    "browser": true
-  , "devel": true
-  , "bitwise": true
-  , "undef": true
-  , "trailing": true
-  , "quotmark": false
-  , "indent": 4
-  , "unused": "vars"
-  , "latedef": "nofunc"
-  , "globals": {
-        "module": false,
-        "exports": false,
-        "require": false
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 0f1fbdf..eb744f1 100644
--- a/package.json
+++ b/package.json
@@ -41,8 +41,8 @@
     "cordova-blackberry10"
   ],
   "scripts": {
-    "test": "npm run jshint",
-    "jshint": "jshint www && jshint src && jshint tests"
+    "test": "npm run eslint",
+    "eslint": "eslint www && eslint src && eslint tests"
   },
   "author": "Apache Software Foundation",
   "license": "Apache-2.0",
@@ -54,6 +54,12 @@
     }
   },
   "devDependencies": {
-    "jshint": "^2.6.0"
+    "eslint": "^4.0.0",
+    "eslint-config-semistandard": "^11.0.0",
+    "eslint-config-standard": "^10.2.1",
+    "eslint-plugin-import": "^2.3.0",
+    "eslint-plugin-node": "^5.0.0",
+    "eslint-plugin-promise": "^3.5.0",
+    "eslint-plugin-standard": "^3.0.1"
   }
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index 05fde27..b9fe9b3 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -41,11 +41,11 @@ var globalization = {
     *    globalization.getPreferredLanguage(function (language) {alert('language:' + language.value + '\n');},
     *                                function () {});
     */
-    getPreferredLanguage:function(successCB, failureCB, args, env) {
-        var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("getPreferredLanguage", args),
-            data = JSON.parse(response);
-        console.log("getPreferredLanguage: " + JSON.stringify(response));
+    getPreferredLanguage: function (successCB, failureCB, args, env) {
+        var result = new PluginResult(args, env);
+        var response = g11n.getInstance().InvokeMethod('getPreferredLanguage', args);
+        var data = JSON.parse(response);
+        console.log('getPreferredLanguage: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -76,11 +76,11 @@ var globalization = {
     *    globalization.getLocaleName(function (locale) {alert('locale:' + locale.value + '\n');},
     *                                function () {});
     */
-    getLocaleName:function(successCB, failureCB, args, env) {
-        var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("getLocaleName", args),
-            data = JSON.parse(response);
-        console.log("getLocaleName: " + JSON.stringify(response));
+    getLocaleName: function (successCB, failureCB, args, env) {
+        var result = new PluginResult(args, env);
+        var response = g11n.getInstance().InvokeMethod('getLocaleName', args);
+        var data = JSON.parse(response);
+        console.log('getLocaleName: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -94,7 +94,6 @@ var globalization = {
         }
     },
 
-
     /**
     * Returns a date formatted as a string according to the client's user preferences and
     * calendar using the time zone of the client. It returns the formatted date string to the
@@ -120,11 +119,11 @@ var globalization = {
     *                function (errorCode) {alert(errorCode);},
     *                {formatLength:'short'});
     */
-    dateToString:function(successCB, failureCB, args, env) {
-        var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("dateToString", args),
-            data = JSON.parse(response);
-        console.log("dateToString: " + JSON.stringify(response));
+    dateToString: function (successCB, failureCB, args, env) {
+        var result = new PluginResult(args, env);
+        var response = g11n.getInstance().InvokeMethod('dateToString', args);
+        var data = JSON.parse(response);
+        console.log('dateToString: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -138,7 +137,6 @@ var globalization = {
         }
     },
 
-
     /**
     * Parses a date formatted as a string according to the client's user
     * preferences and calendar using the time zone of the client and returns
@@ -174,11 +172,11 @@ var globalization = {
     *                function (errorCode) {alert(errorCode);},
     *                {selector:'date'});
     */
-    stringToDate:function(successCB, failureCB, args, env) {
-        var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("stringToDate", args),
-            data = JSON.parse(response);
-        console.log("stringToDate: " + JSON.stringify(response));
+    stringToDate: function (successCB, failureCB, args, env) {
+        var result = new PluginResult(args, env);
+        var response = g11n.getInstance().InvokeMethod('stringToDate', args);
+        var data = JSON.parse(response);
+        console.log('stringToDate: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -198,7 +196,6 @@ var globalization = {
         }
     },
 
-
     /**
     * Returns a pattern string for formatting and parsing dates according to the client's
     * user preferences. It returns the pattern to the successCB callback with a
@@ -231,11 +228,11 @@ var globalization = {
     *                function () {},
     *                {formatLength:'short'});
     */
-    getDatePattern:function(successCB, failureCB, args, env) {
-        var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("getDatePattern", args),
-            data = JSON.parse(response);
-        console.log("getDatePattern: " + JSON.stringify(response));
+    getDatePattern: function (successCB, failureCB, args, env) {
+        var result = new PluginResult(args, env);
+        var response = g11n.getInstance().InvokeMethod('getDatePattern', args);
+        var data = JSON.parse(response);
+        console.log('getDatePattern: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -252,7 +249,6 @@ var globalization = {
         }
     },
 
-
     /**
     * Returns an array of either the names of the months or days of the week
     * according to the client's user preferences and calendar. It returns the array of names to the
@@ -278,11 +274,11 @@ var globalization = {
     *            alert('Month:' + names.value[i] + '\n');}},
     *        function () {});
     */
-    getDateNames:function(successCB, failureCB, args, env) {
-        var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("getDateNames", args),
-            data = JSON.parse(response);
-        console.log("getDateNames: " + JSON.stringify(response));
+    getDateNames: function (successCB, failureCB, args, env) {
+        var result = new PluginResult(args, env);
+        var response = g11n.getInstance().InvokeMethod('getDateNames', args);
+        var data = JSON.parse(response);
+        console.log('getDateNames: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -316,11 +312,11 @@ var globalization = {
     *                function (date) {alert('dst:' + date.dst + '\n');}
     *                function () {});
     */
-    isDayLightSavingsTime:function(successCB, failureCB, args, env) {
+    isDayLightSavingsTime: function (successCB, failureCB, args, env) {
         var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("isDayLightSavingsTime", args),
+            response = g11n.getInstance().InvokeMethod('isDayLightSavingsTime', args),
             data = JSON.parse(response);
-        console.log("isDayLightSavingsTime: " + JSON.stringify(response));
+        console.log('isDayLightSavingsTime: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -352,11 +348,11 @@ var globalization = {
     *                { alert('Day:' + day.value + '\n');},
     *                function () {});
     */
-    getFirstDayOfWeek:function(successCB, failureCB, args, env) {
+    getFirstDayOfWeek: function (successCB, failureCB, args, env) {
         var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("getFirstDayOfWeek", args),
+            response = g11n.getInstance().InvokeMethod('getFirstDayOfWeek', args),
             data = JSON.parse(response);
-        console.log("getFirstDayOfWeek: " + JSON.stringify(response));
+        console.log('getFirstDayOfWeek: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -370,7 +366,6 @@ var globalization = {
         }
     },
 
-
     /**
     * Returns a number formatted as a string according to the client's user preferences.
     * It returns the formatted number string to the successCB callback with a properties object as a
@@ -394,11 +389,11 @@ var globalization = {
     *                function () {},
     *                {type:'decimal'});
     */
-    numberToString:function(successCB, failureCB, args, env) {
+    numberToString: function (successCB, failureCB, args, env) {
         var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("numberToString", args),
+            response = g11n.getInstance().InvokeMethod('numberToString', args),
             data = JSON.parse(response);
-        console.log("numberToString: " + JSON.stringify(response));
+        console.log('numberToString: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -435,11 +430,11 @@ var globalization = {
     *                function (number) {alert('Number:' + number.value + '\n');},
     *                function () { alert('Error parsing number');});
     */
-    stringToNumber:function(successCB, failureCB, args, env) {
+    stringToNumber: function (successCB, failureCB, args, env) {
         var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("stringToNumber", args),
+            response = g11n.getInstance().InvokeMethod('stringToNumber', args),
             data = JSON.parse(response);
-        console.log("stringToNumber: " + JSON.stringify(response));
+        console.log('stringToNumber: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -485,11 +480,11 @@ var globalization = {
     *                function (pattern) {alert('Pattern:' + pattern.pattern + '\n');},
     *                function () {});
     */
-    getNumberPattern:function(successCB, failureCB, args, env) {
+    getNumberPattern: function (successCB, failureCB, args, env) {
         var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("getNumberPattern", args),
+            response = g11n.getInstance().InvokeMethod('getNumberPattern', args),
             data = JSON.parse(response);
-        console.log("getNumberPattern: " + JSON.stringify(response));
+        console.log('getNumberPattern: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -537,11 +532,11 @@ var globalization = {
     *                function (currency) {alert('Pattern:' + currency.pattern + '\n');}
     *                function () {});
     */
-    getCurrencyPattern:function(successCB, failureCB, args, env) {
+    getCurrencyPattern: function (successCB, failureCB, args, env) {
         var result = new PluginResult(args, env),
-            response = g11n.getInstance().InvokeMethod("getCurrencyPattern", args),
+            response = g11n.getInstance().InvokeMethod('getCurrencyPattern', args),
             data = JSON.parse(response);
-        console.log("getCurrencyPattern: " + JSON.stringify(response));
+        console.log('getCurrencyPattern: ' + JSON.stringify(response));
 
         if (data.error !== undefined) {
             result.error({
@@ -563,66 +558,61 @@ var globalization = {
 
 module.exports = globalization;
 
-function lineArgsFromArray(args) {
-    var cmd = "";
+function lineArgsFromArray (args) {
+    var cmd = '';
 
-    if ("callbackId" in args)
-        cmd += decodeURIComponent(args.callbackId);
-    if ("0" in args) {
-        if (cmd.length > 0)
-            cmd += " ";
-        cmd += decodeURIComponent(args["0"]);
+    if ('callbackId' in args) { cmd += decodeURIComponent(args.callbackId); }
+    if ('0' in args) {
+        if (cmd.length > 0) { cmd += ' '; }
+        cmd += decodeURIComponent(args['0']);
     }
 
     return cmd;
 }
 
-function cmdLineForMethod(method, args) {
+function cmdLineForMethod (method, args) {
     var cmd = lineArgsFromArray(args);
-    if (cmd.length > 0)
-        return method + " " + cmd;
-    else
-        return method;
+    if (cmd.length > 0) { return method + ' ' + cmd; } else { return method; }
 }
 
-///////////////////////////////////////////////////////////////////
+/// ////////////////////////////////////////////////////////////////
 // JavaScript wrapper for JNEXT plugin
-///////////////////////////////////////////////////////////////////
+/// ////////////////////////////////////////////////////////////////
 
 JNEXT.Globalization = function () {
     var self = this,
         hasInstance = false;
 
     self.InvokeMethod = function (method, args) {
-        //This is how Javascript calls into native
+        // This is how Javascript calls into native
         return JNEXT.invoke(self.m_id, cmdLineForMethod(method, args));
     };
 
     self.init = function () {
-        //Checks that the jnext library is present and loads it
-        if (!JNEXT.require("libGlobalization")) {
+        // Checks that the jnext library is present and loads it
+        if (!JNEXT.require('libGlobalization')) {
             return false;
         }
 
-        //Creates the native object that this interface will call
-        self.m_id = JNEXT.createObject("libGlobalization.Globalization");
+        // Creates the native object that this interface will call
+        self.m_id = JNEXT.createObject('libGlobalization.Globalization');
 
-        if (self.m_id === "") {
+        if (self.m_id === '') {
             return false;
         }
 
-        //Registers for the JNEXT event loop
+        // Registers for the JNEXT event loop
         JNEXT.registerEvents(self);
     };
 
-    self.m_id = "";
+    self.m_id = '';
 
-    //Used by JNEXT library to get the ID
+    // Used by JNEXT library to get the ID
     self.getId = function () {
         return self.m_id;
     };
 
-    //Not truly required but useful for instance management
+    // Not truly required but useful for instance management
     self.getInstance = function () {
         if (!hasInstance) {
             self.init();
@@ -633,4 +623,3 @@ JNEXT.Globalization = function () {
 };
 
 g11n = new JNEXT.Globalization();
-

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/src/browser/GlobalizationProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/GlobalizationProxy.js b/src/browser/GlobalizationProxy.js
index 1c21a52..5e99920 100644
--- a/src/browser/GlobalizationProxy.js
+++ b/src/browser/GlobalizationProxy.js
@@ -22,32 +22,32 @@
 var GlobalizationError = require('./GlobalizationError');
 var moment = require('cordova-plugin-globalization.moment');
 
-function getCrossPlatformLocale() {
+function getCrossPlatformLocale () {
     // userLanguage is for IE, which corresponds to selected regional format
     return navigator.userLanguage || navigator.language;
 }
 
-function stdTimezoneOffset(date) {
+function stdTimezoneOffset (date) {
     var jan = new Date(date.getFullYear(), 0, 20);
     var jul = new Date(date.getFullYear(), 6, 20);
     return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
 }
 
-function dst(date) {
+function dst (date) {
     return date.getTimezoneOffset() < stdTimezoneOffset(date);
 }
 
-function dstOffsetAbs(date) {
+function dstOffsetAbs (date) {
     var janOffset = new Date(date.getFullYear(), 0, 20).getTimezoneOffset();
     var julOffset = new Date(date.getFullYear(), 6, 20).getTimezoneOffset();
     if (janOffset < 0) { janOffset = -janOffset; }
     if (julOffset < 0) { julOffset = -julOffset; }
-    var offset =  janOffset - julOffset;
+    var offset = janOffset - julOffset;
     if (offset < 0) { offset = -offset; }
     return offset;
 }
 
-function getWeekDayNames(locale, options) {
+function getWeekDayNames (locale, options) {
     var result = [], date;
     for (var i = 0; i < 7; i++) {
         date = new Date(2014, 5, i + 1, 0, 0, 0, 0);
@@ -56,69 +56,69 @@ function getWeekDayNames(locale, options) {
     return result;
 }
 
-function convertToIntlNumberFormatOptions(options) {
+function convertToIntlNumberFormatOptions (options) {
     switch (options.type) {
-        case 'decimal':
-            return { style: 'decimal' };
-        case 'currency':
-            throw '\'currency\' number type is not supported';
-        case 'percent':
-            return { style: 'percent' };
-        default:
-            throw 'The options.type can be \'decimal\', \'percent\' or \'currency\'';
+    case 'decimal':
+        return { style: 'decimal' };
+    case 'currency':
+        throw '\'currency\' number type is not supported';
+    case 'percent':
+        return { style: 'percent' };
+    default:
+        throw 'The options.type can be \'decimal\', \'percent\' or \'currency\'';
     }
 }
 
-function convertToMomentLocalizedFormat(options) {
+function convertToMomentLocalizedFormat (options) {
     var selectorError = 'The options.selector can be \'date\', \'time\' or \'date and time\'';
     var formatLengthError = 'The options.formatLength can be \'short\', \'medium\', \'long\', or \'full\'';
 
     switch (options.formatLength) {
-        case 'short':
-            switch(options.selector) {
-                case 'date and time': return 'lll';
-                case 'date': return 'l';
-                case 'time': return 'LT';
-                default:
-                    throw selectorError;
-            }
-            break;
-        case 'medium':
-            switch(options.selector) {
-                case 'date and time': return 'LLL';
-                case 'date': return 'L';
-                case 'time': 
-                    throw '\'time\' selector does not support \'medium\' formatLength';
-                default:
-                    throw selectorError;
-            }
-            break;
-        case 'long':
-            switch(options.selector) {
-                case 'date and time': return 'llll';
-                case 'date': return 'll';
-                case 'time': 
-                    throw '\'time\' selector does not support \'long\' formatLength';
-                default:
-                    throw selectorError;
-            }
-            break;
-        case 'full':
-            switch(options.selector) {
-                case 'date and time': return 'LLLL';
-                case 'date': return 'LL';
-                case 'time': return 'LTS';
-                default:
-                    throw selectorError;
-            }
-            break;
+    case 'short':
+        switch (options.selector) {
+        case 'date and time': return 'lll';
+        case 'date': return 'l';
+        case 'time': return 'LT';
+        default:
+            throw selectorError;
+        }
+        break;
+    case 'medium':
+        switch (options.selector) {
+        case 'date and time': return 'LLL';
+        case 'date': return 'L';
+        case 'time':
+            throw '\'time\' selector does not support \'medium\' formatLength';
         default:
-            throw formatLengthError;
+            throw selectorError;
+        }
+        break;
+    case 'long':
+        switch (options.selector) {
+        case 'date and time': return 'llll';
+        case 'date': return 'll';
+        case 'time':
+            throw '\'time\' selector does not support \'long\' formatLength';
+        default:
+            throw selectorError;
+        }
+        break;
+    case 'full':
+        switch (options.selector) {
+        case 'date and time': return 'LLLL';
+        case 'date': return 'LL';
+        case 'time': return 'LTS';
+        default:
+            throw selectorError;
+        }
+        break;
+    default:
+        throw formatLengthError;
     }
 }
 
-function prepareAndGetDateOptions(options) {
-    options = options || {formatLength:'short', selector:'date and time'};
+function prepareAndGetDateOptions (options) {
+    options = options || {formatLength: 'short', selector: 'date and time'};
     options.formatLength = options.formatLength || 'short';
     options.selector = options.selector || 'date and time';
 
@@ -126,39 +126,39 @@ function prepareAndGetDateOptions(options) {
 }
 
 var globalization = {
-    getLocaleName: function(win, fail) {
+    getLocaleName: function (win, fail) {
         try {
-            win( { value: getCrossPlatformLocale() });
+            win({ value: getCrossPlatformLocale() });
         } catch (e) {
-            fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+            fail({ code: 0, message: e.hasOwnProperty('message') ? e.message : e });
         }
     },
 
-    numberToString: function(win, fail, args) {
+    numberToString: function (win, fail, args) {
         try {
-            var options = args[0].options || { type : 'decimal' };
+            var options = args[0].options || { type: 'decimal' };
             options.type = options.type || 'decimal';
 
             options = convertToIntlNumberFormatOptions(options);
 
             var formatter = new Intl.NumberFormat(getCrossPlatformLocale(), options);
-            win( { value: formatter.format(args[0].number) });
+            win({ value: formatter.format(args[0].number) });
         } catch (e) {
-            fail(new GlobalizationError(GlobalizationError.FORMATTING_ERROR, 
-                e.hasOwnProperty('message')? e.message : e));
+            fail(new GlobalizationError(GlobalizationError.FORMATTING_ERROR,
+                e.hasOwnProperty('message') ? e.message : e));
         }
     },
 
-    isDayLightSavingsTime: function(win, fail, args) {
+    isDayLightSavingsTime: function (win, fail, args) {
         try {
             var date = new Date(args[0].date);
             win({ dst: dst(date) });
         } catch (e) {
-            fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+            fail({ code: 0, message: e.hasOwnProperty('message') ? e.message : e });
         }
     },
 
-    getFirstDayOfWeek: function(win, fail) {
+    getFirstDayOfWeek: function (win, fail) {
         try {
             var locale = getCrossPlatformLocale();
             moment.locale(locale);
@@ -166,7 +166,7 @@ var globalization = {
             var shiftDay = moment().weekday(0).isoWeekday() + 1;
             win({ value: shiftDay % 8 + Math.floor(shiftDay / 8) });
         } catch (e) {
-            fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+            fail({ code: 0, message: e.hasOwnProperty('message') ? e.message : e });
         }
     },
 
@@ -202,31 +202,31 @@ var globalization = {
 
             win({ value: result });
         } catch (e) {
-            fail({ code: 0, message: e.hasOwnProperty('message')? e.message : e });
+            fail({ code: 0, message: e.hasOwnProperty('message') ? e.message : e });
         }
     },
 
-    getDatePattern: function(win, fail) {
+    getDatePattern: function (win, fail) {
         try {
-          var formatter = new Intl.DateTimeFormat(getCrossPlatformLocale());
-          var timezone = formatter.hasOwnProperty('resolved') ? formatter.resolved.timeZone : '';
-          var dstOffset = dstOffsetAbs(new Date());
+            var formatter = new Intl.DateTimeFormat(getCrossPlatformLocale());
+            var timezone = formatter.hasOwnProperty('resolved') ? formatter.resolved.timeZone : '';
+            var dstOffset = dstOffsetAbs(new Date());
 
-          win( { 
+            win({
                 utc_offset: new Date().getTimezoneOffset() * (-60),
                 dst_offset: dstOffset * 60,
                 timezone: timezone,
-                pattern: '',
-               });
+                pattern: ''
+            });
         } catch (e) {
-            fail(new GlobalizationError(GlobalizationError.PATTERN_ERROR, 
-                e.hasOwnProperty('message')? e.message : e));
+            fail(new GlobalizationError(GlobalizationError.PATTERN_ERROR,
+                e.hasOwnProperty('message') ? e.message : e));
         }
     },
 
-    getNumberPattern: function(win, fail, args) {
+    getNumberPattern: function (win, fail, args) {
         try {
-            var options = args[0].options || { type : 'decimal'};
+            var options = args[0].options || { type: 'decimal'};
             options.type = options.type || 'decimal';
 
             options = convertToIntlNumberFormatOptions(options);
@@ -234,11 +234,11 @@ var globalization = {
             var formatter = new Intl.NumberFormat(getCrossPlatformLocale(), options);
 
             if (!formatter.hasOwnProperty('resolved')) {
-                fail('Not supported'); 
-                return; 
+                fail('Not supported');
+                return;
             }
             var pattern = formatter.resolved.pattern;
-            win( { 
+            win({
                 pattern: pattern,
                 symbol: '',
                 fraction: 0,
@@ -246,59 +246,59 @@ var globalization = {
                 positive: '',
                 negative: '',
                 decimal: '',
-                grouping: '',
+                grouping: ''
             });
         } catch (e) {
-            fail(new GlobalizationError(GlobalizationError.PATTERN_ERROR, 
-                e.hasOwnProperty('message')? e.message : e));
+            fail(new GlobalizationError(GlobalizationError.PATTERN_ERROR,
+                e.hasOwnProperty('message') ? e.message : e));
         }
     },
 
-    getPreferredLanguage: function(win, fail, args) {
+    getPreferredLanguage: function (win, fail, args) {
         // Falling back on locale
         globalization.getLocaleName(win, fail);
     },
 
-    getCurrencyPattern: function(win, fail, args) {
+    getCurrencyPattern: function (win, fail, args) {
         fail('Not supported');
     },
 
-    stringToDate: function(win, fail, args) {
+    stringToDate: function (win, fail, args) {
         try {
             var options = prepareAndGetDateOptions(args[0].options);
             moment.locale(getCrossPlatformLocale());
 
             var date = moment(args[0].dateString, options).toDate();
 
-            win({ 
-                year: date.getFullYear(), 
-                month: date.getMonth(), 
+            win({
+                year: date.getFullYear(),
+                month: date.getMonth(),
                 day: date.getDate(),
-                hour: date.getHours(), 
-                minute: date.getMinutes(), 
+                hour: date.getHours(),
+                minute: date.getMinutes(),
                 second: date.getSeconds(),
                 millisecond: date.getMilliseconds()
             });
         } catch (e) {
-            fail(new GlobalizationError(GlobalizationError.PARSING_ERROR, 
-                    e.hasOwnProperty('message')? e.message : e));
+            fail(new GlobalizationError(GlobalizationError.PARSING_ERROR,
+                    e.hasOwnProperty('message') ? e.message : e));
         }
     },
 
-    stringToNumber: function(win, fail, args) {
+    stringToNumber: function (win, fail, args) {
         fail('Not supported');
     },
 
-    dateToString: function(win, fail, args) {
+    dateToString: function (win, fail, args) {
         try {
             var date = new Date(args[0].date);
             var options = prepareAndGetDateOptions(args[0].options);
             moment.locale(getCrossPlatformLocale());
 
-            win({ value : moment(date).format(options)});
+            win({ value: moment(date).format(options)});
         } catch (e) {
-            fail(new GlobalizationError(GlobalizationError.FORMATTING_ERROR, 
-                    e.hasOwnProperty('message')? e.message : e));
+            fail(new GlobalizationError(GlobalizationError.FORMATTING_ERROR,
+                    e.hasOwnProperty('message') ? e.message : e));
         }
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/src/firefoxos/GlobalizationProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/GlobalizationProxy.js b/src/firefoxos/GlobalizationProxy.js
index 07d92dc..42048d6 100644
--- a/src/firefoxos/GlobalizationProxy.js
+++ b/src/firefoxos/GlobalizationProxy.js
@@ -26,31 +26,30 @@ var l10n_ready = new Event('l10n_ready');
 
 var is_l10n_ready = false;
 
-document.addEventListener('l10n_loaded', function() {
-  console.log('DEBUG: L10n loaded');
-  navigator.mozL10n.ready(function() {
-    console.log('DEBUG: L10n ready');
-    is_l10n_ready = true;
-    document.dispatchEvent(l10n_ready);
-  });
+document.addEventListener('l10n_loaded', function () {
+    console.log('DEBUG: L10n loaded');
+    navigator.mozL10n.ready(function () {
+        console.log('DEBUG: L10n ready');
+        is_l10n_ready = true;
+        document.dispatchEvent(l10n_ready);
+    });
 });
 
-function callIfL10nReady(callback) {
+function callIfL10nReady (callback) {
     if (is_l10n_ready) {
         return callback();
     }
     document.addEventListener('l10n_ready', callback);
 }
 
-
-function loadFile(elementName, attributes, callback) {
+function loadFile (elementName, attributes, callback) {
     var e = document.createElement(elementName);
     for (var attrName in attributes) {
-      if(attributes.hasOwnProperty(attrName)) {
-        e.setAttribute(attrName, attributes[attrName]);
-      }
+        if (attributes.hasOwnProperty(attrName)) {
+            e.setAttribute(attrName, attributes[attrName]);
+        }
     }
-    e.onreadystatechange = e.onload = function() {
+    e.onreadystatechange = e.onload = function () {
         var state = e.readyState;
         if (!callback.done && (!state || /loaded|complete/.test(state))) {
             callback.done = true;
@@ -60,68 +59,68 @@ function loadFile(elementName, attributes, callback) {
     document.head.appendChild(e);
 }
 
-function loadDependencies() {
+function loadDependencies () {
   // Adding globalization file to the HEAD section
   // <link rel="resource" type="application/l10n" href="locales/date.ini" />
 
-  loadFile('link', {
-    'rel': 'resource', 
-    'type': 'application/l10n', 
-    'href': 'locales/date.ini'}, function() {});
-  loadFile('script', {
-    'type': 'text/javascript',
-    'src': 'js/l10n.js'},
-    function() {
-      loadFile('script', {
+    loadFile('link', {
+        'rel': 'resource',
+        'type': 'application/l10n',
+        'href': 'locales/date.ini'}, function () {});
+    loadFile('script', {
         'type': 'text/javascript',
-        'src': 'js/l10n_date.js'},
-        function() {
-          document.dispatchEvent(l10n_loaded);
+        'src': 'js/l10n.js'},
+    function () {
+        loadFile('script', {
+            'type': 'text/javascript',
+            'src': 'js/l10n_date.js'},
+        function () {
+            document.dispatchEvent(l10n_loaded);
         });
     });
 }
 
 loadDependencies();
 
-function getPreferredLanguage(successCB, errorCB) {
+function getPreferredLanguage (successCB, errorCB) {
     // WARNING: this isn't perfect - there is a difference between UI language
     // and preferred language, however it doesn't happen too often.
-    callIfL10nReady(function() {
-      successCB({value: navigator.mozL10n.language.code});
+    callIfL10nReady(function () {
+        successCB({value: navigator.mozL10n.language.code});
     });
 }
 
-function getLocaleName(successCB, errorCB) {
-    callIfL10nReady(function() {
-      successCB(navigator.mozL10n.language.code);
+function getLocaleName (successCB, errorCB) {
+    callIfL10nReady(function () {
+        successCB(navigator.mozL10n.language.code);
     });
 }
 
-function dateToString(successCB, errorCB, params) {
+function dateToString (successCB, errorCB, params) {
     var date = new Date(params[0].date);
     var options = params[0].options;
 
-    callIfL10nReady(function() {
-      var f = new navigator.mozL10n.DateTimeFormat();
-      successCB({'value': _getStringFromDate(f, date, options)});
+    callIfL10nReady(function () {
+        var f = new navigator.mozL10n.DateTimeFormat();
+        successCB({'value': _getStringFromDate(f, date, options)});
     });
 
-    function _getStringFromDate(f, date, options) {
+    function _getStringFromDate (f, date, options) {
         var format = navigator.mozL10n.get('shortDateTimeFormat');
         if (options) {
-          if (options.selector === 'date') {
-            return f.localeDateString(date);
-          }
-          if (options.selector === 'time') {
-            return f.localeTimeString(date);
-          }
-          if (options.formatLength !== 'short') {
-            format = navigator.mozL10n.get('dateTimeFormat');
-            return f.localeString(date, format);
-          }
-          if (options.selector === 'time') {
-            return f.localeTimeString(date, format);
-          }
+            if (options.selector === 'date') {
+                return f.localeDateString(date);
+            }
+            if (options.selector === 'time') {
+                return f.localeTimeString(date);
+            }
+            if (options.formatLength !== 'short') {
+                format = navigator.mozL10n.get('dateTimeFormat');
+                return f.localeString(date, format);
+            }
+            if (options.selector === 'time') {
+                return f.localeTimeString(date, format);
+            }
         }
         var d = f.localeDateString(date);
         var t = f.localeTimeString(date);
@@ -129,117 +128,117 @@ function dateToString(successCB, errorCB, params) {
     }
 }
 
-function stringToDate(successCB, errorCB, params) {
+function stringToDate (successCB, errorCB, params) {
     var date;
     var dateString = params[0].dateString;
     var options = params[0].options;
     try {
-      date = new Date(dateString);
-    } catch(e) {  
-      console.log("Cordova, stringToDate, An error occurred " + e.message);
-      return errorCB(new GlobalizationError(
+        date = new Date(dateString);
+    } catch (e) {
+        console.log('Cordova, stringToDate, An error occurred ' + e.message);
+        return errorCB(new GlobalizationError(
             GlobalizationError.PARSING_ERROR, e.message));
-    } 
+    }
     if (!date || date === 'Invalid Date') {
-      console.log("Cordova, stringToDate, Invalid Date: " + dateString);
-      return errorCB(new GlobalizationError(
+        console.log('Cordova, stringToDate, Invalid Date: ' + dateString);
+        return errorCB(new GlobalizationError(
             GlobalizationError.PARSING_ERROR, 'Invalid Date (' + dateString + ')'));
     }
 
     var dateObj = {
-      'year': date.getFullYear(),
-      'month': date.getMonth(),
-      'day': date.getDay() 
+        'year': date.getFullYear(),
+        'month': date.getMonth(),
+        'day': date.getDay()
     };
     var timeObj = {
-      'hour': date.getHours(),
-      'minute': date.getMinutes(),
-      'second': date.getSeconds(),
-      'millisecond': date.getMilliseconds() 
+        'hour': date.getHours(),
+        'minute': date.getMinutes(),
+        'second': date.getSeconds(),
+        'millisecond': date.getMilliseconds()
     };
     if (options) {
-      if (options.selector === 'date') {
-        return successCB(dateObj);
-      }
-      if (options.selector === 'time') {
-        return successCB(timeObj);
-      }
+        if (options.selector === 'date') {
+            return successCB(dateObj);
+        }
+        if (options.selector === 'time') {
+            return successCB(timeObj);
+        }
     }
     for (var i in timeObj) {
-      if (timeObj.hasOwnProperty(i)) {
-        dateObj[i] = timeObj[i];
-      }
+        if (timeObj.hasOwnProperty(i)) {
+            dateObj[i] = timeObj[i];
+        }
     }
     successCB(dateObj);
 }
 
-function getDatePattern(successCB, failureCB, options) {
+function getDatePattern (successCB, failureCB, options) {
     failureCB(GlobalizationError.UNKNOWN_ERROR, 'unsupported');
 }
 
-function getDateNames(successCB, failureCB, params) {
-  callIfL10nReady(function() {
-    var version = 'long';
-    var item = 'month';
-    var options = params[0].options;
-    if (options) {
-      if (options.type === 'narrow') {
-        version = 'short';
-      } else if (options.type === 'genitive' && options.item === 'months') {
-        version = options.type;
-      } 
-      if (options.item === 'days') {
-        item = 'weekday';
-      }
-    }
-    var limit = (item === 'month') ? 11 : 6;
+function getDateNames (successCB, failureCB, params) {
+    callIfL10nReady(function () {
+        var version = 'long';
+        var item = 'month';
+        var options = params[0].options;
+        if (options) {
+            if (options.type === 'narrow') {
+                version = 'short';
+            } else if (options.type === 'genitive' && options.item === 'months') {
+                version = options.type;
+            }
+            if (options.item === 'days') {
+                item = 'weekday';
+            }
+        }
+        var limit = (item === 'month') ? 11 : 6;
 
-    var arr = [];
-    for (var i = 0; i <= limit; i++) {
-        arr.push(navigator.mozL10n.get(item + '-' + i + '-' + version));
-    }
-    successCB({'value': arr});
-  });
+        var arr = [];
+        for (var i = 0; i <= limit; i++) {
+            arr.push(navigator.mozL10n.get(item + '-' + i + '-' + version));
+        }
+        successCB({'value': arr});
+    });
 }
 
-Date.prototype.stdTimezoneOffset = function() {
+Date.prototype.stdTimezoneOffset = function () {
     // Return the standard timezone offset (usually 0 or -600)
     var jan = new Date(this.getFullYear(), 0, 1);
     var jul = new Date(this.getFullYear(), 6, 1);
     return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
 };
 
-Date.prototype.isDayLightSavingsTime = function() {
+Date.prototype.isDayLightSavingsTime = function () {
     return this.getTimezoneOffset() < this.stdTimezoneOffset();
 };
 
-function isDayLightSavingsTime(successCB, failureCB, params) {
+function isDayLightSavingsTime (successCB, failureCB, params) {
     var date = new Date(params[0].date);
     successCB({'dst': date.isDayLightSavingsTime()});
 }
 
-function getFirstDayOfWeek(successCB, failureCB) {
-  callIfL10nReady(function() {
-    var firstDay = navigator.mozL10n.get('weekStartsOnMonday');
+function getFirstDayOfWeek (successCB, failureCB) {
+    callIfL10nReady(function () {
+        var firstDay = navigator.mozL10n.get('weekStartsOnMonday');
     // Sunday: 1
     // Monday: 2
-    successCB({'value': 1 + parseInt(firstDay)});
-  });
+        successCB({'value': 1 + parseInt(firstDay)});
+    });
 }
 
-function numberToString(number, successCB, failureCB) {
+function numberToString (number, successCB, failureCB) {
     failureCB(GlobalizationError.UNKNOWN_ERROR, 'unsupported');
 }
 
-function stringToNumber(numberString, successCB, failureCB, options) {
+function stringToNumber (numberString, successCB, failureCB, options) {
     failureCB(GlobalizationError.UNKNOWN_ERROR, 'unsupported');
 }
 
-function getNumberPattern(successCB, failureCB, options) {
+function getNumberPattern (successCB, failureCB, options) {
     failureCB(GlobalizationError.UNKNOWN_ERROR, 'unsupported');
 }
 
-function getCurrencyPattern(currencyCode, successCB, failureCB) {
+function getCurrencyPattern (currencyCode, successCB, failureCB) {
     failureCB(GlobalizationError.UNKNOWN_ERROR, 'unsupported');
 }
 
@@ -258,4 +257,4 @@ var Globalization = {
     getCurrencyPattern: getCurrencyPattern
 };
 
-require("cordova/exec/proxy").add("Globalization", Globalization);
+require('cordova/exec/proxy').add('Globalization', Globalization);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/src/tizen/GlobalizationProxy.js
----------------------------------------------------------------------
diff --git a/src/tizen/GlobalizationProxy.js b/src/tizen/GlobalizationProxy.js
index bfde856..9b39ba7 100644
--- a/src/tizen/GlobalizationProxy.js
+++ b/src/tizen/GlobalizationProxy.js
@@ -21,8 +21,8 @@
 
 /* global tizen */
 
-var argscheck = require('cordova/argscheck'),
-    GlobalizationError = require('cordova-plugin-globalization.GlobalizationError');
+var argscheck = require('cordova/argscheck');
+var GlobalizationError = require('cordova-plugin-globalization.GlobalizationError');
 
 var globalization = {
     /**
@@ -42,18 +42,18 @@ var globalization = {
     *    globalization.getPreferredLanguage(function (language) {alert('language:' + language.value + '\n');},
     *                                function () {});
     */
-    getPreferredLanguage:function(successCB, failureCB) {
+    getPreferredLanguage: function (successCB, failureCB) {
         console.log('exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);');
 
-        tizen.systeminfo.getPropertyValue (
-            "LOCALE",
+        tizen.systeminfo.getPropertyValue(
+            'LOCALE',
             function (localeInfo) {
-                console.log("Cordova, getLocaleName, language is  " + localeInfo.language);
-                successCB( {"value": localeInfo.language});
+                console.log('Cordova, getLocaleName, language is  ' + localeInfo.language);
+                successCB({'value': localeInfo.language});
             },
-            function(error) {
-                console.log("Cordova, getLocaleName, An error occurred " + error.message);
-                failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve language name"));
+            function (error) {
+                console.log('Cordova, getLocaleName, An error occurred ' + error.message);
+                failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'cannot retrieve language name'));
             }
         );
     },
@@ -75,21 +75,20 @@ var globalization = {
     *    globalization.getLocaleName(function (locale) {alert('locale:' + locale.value + '\n');},
     *                                function () {});
     */
-    getLocaleName:function(successCB, failureCB) {
-        tizen.systeminfo.getPropertyValue (
-            "LOCALE",
+    getLocaleName: function (successCB, failureCB) {
+        tizen.systeminfo.getPropertyValue(
+            'LOCALE',
             function (localeInfo) {
-                console.log("Cordova, getLocaleName, locale name (country) is  " + localeInfo.country);
-                successCB( {"value":localeInfo.language});
+                console.log('Cordova, getLocaleName, locale name (country) is  ' + localeInfo.country);
+                successCB({'value': localeInfo.language});
             },
-            function(error) {
-                console.log("Cordova, getLocaleName, An error occurred " + error.message);
-                failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve locale name"));
+            function (error) {
+                console.log('Cordova, getLocaleName, An error occurred ' + error.message);
+                failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'cannot retrieve locale name'));
             }
         );
     },
 
-
     /**
     * Returns a date formatted as a string according to the client's user preferences and
     * calendar using the time zone of the client. It returns the formatted date string to the
@@ -115,7 +114,7 @@ var globalization = {
     *                function (errorCode) {alert(errorCode);},
     *                {formatLength:'short'});
     */
-    dateToString:function(date, successCB, failureCB, options) {
+    dateToString: function (date, successCB, failureCB, options) {
         console.log('exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);');
 
         var tzdate = null;
@@ -124,25 +123,21 @@ var globalization = {
         tzdate = new tizen.TZDate(date);
 
         if (tzdate) {
-            if (options && (options.formatLength == 'short') ){
+            if (options && (options.formatLength === 'short')) {
                 format = tzdate.toLocaleDateString();
-            }
-            else{
+            } else {
                 format = tzdate.toLocaleString();
             }
-            console.log('Cordova, globalization, dateToString ' +format);
+            console.log('Cordova, globalization, dateToString ' + format);
         }
 
-        if (format)
-        {
-            successCB ({"value": format});
-        }
-        else {
-            failureCB(new GlobalizationError(GlobalizationError.FORMATTING_ERROR , "cannot format date string"));
+        if (format) {
+            successCB({'value': format});
+        } else {
+            failureCB(new GlobalizationError(GlobalizationError.FORMATTING_ERROR, 'cannot format date string'));
         }
     },
 
-
     /**
     * Parses a date formatted as a string according to the client's user
     * preferences and calendar using the time zone of the client and returns
@@ -178,15 +173,14 @@ var globalization = {
     *                function (errorCode) {alert(errorCode);},
     *                {selector:'date'});
     */
-    stringToDate:function(dateString, successCB, failureCB, options) {
+    stringToDate: function (dateString, successCB, failureCB, options) {
         argscheck.checkArgs('sfFO', 'Globalization.stringToDate', arguments);
         console.log('exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);');
 
-        //not supported
-        failureCB(new GlobalizationError(GlobalizationError.PARSING_ERROR , "unsupported"));
+        // not supported
+        failureCB(new GlobalizationError(GlobalizationError.PARSING_ERROR, 'unsupported'));
     },
 
-
     /**
     * Returns a pattern string for formatting and parsing dates according to the client's
     * user preferences. It returns the pattern to the successCB callback with a
@@ -219,34 +213,30 @@ var globalization = {
     *                function () {},
     *                {formatLength:'short'});
     */
-    getDatePattern:function(successCB, failureCB, options) {
+    getDatePattern: function (successCB, failureCB, options) {
         console.log(' exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);');
 
-        var shortFormat = (options) ? ( options.formatLength === 'short') : true;
-
-        var formatString = tizen.time.getDateFormat ( shortFormat);
+        var shortFormat = (options) ? (options.formatLength === 'short') : true;
 
+        var formatString = tizen.time.getDateFormat(shortFormat);
 
         var current_datetime = tizen.time.getCurrentDateTime();
 
         // probably will require some control of operation...
-        if (formatString)
-        {
+        if (formatString) {
             successCB(
                 {
-                    "pattern": formatString,
-                    "timezone": current_datetime.getTimezoneAbbreviation(),
-                    "utc_offset": current_datetime.difference(current_datetime.toUTC()).length,
-                    "dst_offset": current_datetime.isDST()
+                    'pattern': formatString,
+                    'timezone': current_datetime.getTimezoneAbbreviation(),
+                    'utc_offset': current_datetime.difference(current_datetime.toUTC()).length,
+                    'dst_offset': current_datetime.isDST()
                 }
             );
-        }
-        else {
-            failureCB(new GlobalizationError(GlobalizationError.PATTERN_ERROR , "cannot get pattern"));
+        } else {
+            failureCB(new GlobalizationError(GlobalizationError.PATTERN_ERROR, 'cannot get pattern'));
         }
     },
 
-
     /**
     * Returns an array of either the names of the months or days of the week
     * according to the client's user preferences and calendar. It returns the array of names to the
@@ -272,11 +262,11 @@ var globalization = {
     *            alert('Month:' + names.value[i] + '\n');}},
     *        function () {});
     */
-    getDateNames:function(successCB, failureCB, options) {
+    getDateNames: function (successCB, failureCB, options) {
         argscheck.checkArgs('fFO', 'Globalization.getDateNames', arguments);
         console.log('exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);');
 
-        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'unsupported'));
     },
 
     /**
@@ -299,24 +289,23 @@ var globalization = {
     *                function (date) {alert('dst:' + date.dst + '\n');}
     *                function () {});
     */
-    isDayLightSavingsTime:function(date, successCB, failureCB) {
+    isDayLightSavingsTime: function (date, successCB, failureCB) {
 
-        var tzdate = null,
-            isDLS = false;
+        var tzdate = null;
+        var isDLS = false;
 
         console.log('exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);');
-        console.log("date " + date + " value " + date.valueOf()) ;
+        console.log('date ' + date + ' value ' + date.valueOf());
 
         tzdate = new tizen.TZDate(date);
         if (tzdate) {
             isDLS = tzdate && tzdate.isDST();
 
-            console.log ("Cordova, globalization, isDayLightSavingsTime, " + isDLS);
+            console.log('Cordova, globalization, isDayLightSavingsTime, ' + isDLS);
 
-            successCB({"dst":isDLS});
-        }
-        else {
-            failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot get information"));
+            successCB({'dst': isDLS});
+        } else {
+            failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'cannot get information'));
         }
     },
 
@@ -338,18 +327,17 @@ var globalization = {
     *                { alert('Day:' + day.value + '\n');},
     *                function () {});
     */
-    getFirstDayOfWeek:function(successCB, failureCB) {
+    getFirstDayOfWeek: function (successCB, failureCB) {
         argscheck.checkArgs('fF', 'Globalization.getFirstDayOfWeek', arguments);
         console.log('exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);');
 
         // there is no API to get the fist day of the week in Tizen Dvice API
-        successCB({value:1});
+        successCB({value: 1});
 
         // first day of week is a settings in the date book app
         // what about : getting the settings directly or asking the date book ?
     },
 
-
     /**
     * Returns a number formatted as a string according to the client's user preferences.
     * It returns the formatted number string to the successCB callback with a properties object as a
@@ -373,11 +361,11 @@ var globalization = {
     *                function () {},
     *                {type:'decimal'});
     */
-    numberToString:function(number, successCB, failureCB, options) {
+    numberToString: function (number, successCB, failureCB, options) {
         argscheck.checkArgs('nfFO', 'Globalization.numberToString', arguments);
         console.log('exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);');
-        //not supported
-        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+        // not supported
+        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'unsupported'));
     },
 
     /**
@@ -403,12 +391,12 @@ var globalization = {
     *                function (number) {alert('Number:' + number.value + '\n');},
     *                function () { alert('Error parsing number');});
     */
-    stringToNumber:function(numberString, successCB, failureCB, options) {
+    stringToNumber: function (numberString, successCB, failureCB, options) {
         argscheck.checkArgs('sfFO', 'Globalization.stringToNumber', arguments);
         console.log('exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);');
 
-        //not supported
-        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+        // not supported
+        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'unsupported'));
     },
 
     /**
@@ -443,12 +431,12 @@ var globalization = {
     *                function (pattern) {alert('Pattern:' + pattern.pattern + '\n');},
     *                function () {});
     */
-    getNumberPattern:function(successCB, failureCB, options) {
+    getNumberPattern: function (successCB, failureCB, options) {
         argscheck.checkArgs('fFO', 'Globalization.getNumberPattern', arguments);
         console.log('exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);');
 
-        //not supported
-        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+        // not supported
+        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'unsupported'));
     },
 
     /**
@@ -478,15 +466,15 @@ var globalization = {
     *                function (currency) {alert('Pattern:' + currency.pattern + '\n');}
     *                function () {});
     */
-    getCurrencyPattern:function(currencyCode, successCB, failureCB) {
+    getCurrencyPattern: function (currencyCode, successCB, failureCB) {
         argscheck.checkArgs('sfF', 'Globalization.getCurrencyPattern', arguments);
         console.log('exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);');
 
-        //not supported
-        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+        // not supported
+        failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR, 'unsupported'));
     }
 };
 
 module.exports = globalization;
 
-require("cordova/tizen/commandProxy").add("Globalization", module.exports);
+require('cordova/tizen/commandProxy').add('Globalization', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization/blob/86e33d3f/src/windows/GlobalizationProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/GlobalizationProxy.js b/src/windows/GlobalizationProxy.js
index 13bdd1e..b16dc49 100644
--- a/src/windows/GlobalizationProxy.js
+++ b/src/windows/GlobalizationProxy.js
@@ -1,15 +1,15 @@
-/*  
-	Licensed under the Apache License, Version 2.0 (the "License");
-	you may not use this file except in compliance with the License.
-	You may obtain a copy of the License at
-	
-	http://www.apache.org/licenses/LICENSE-2.0
-	
-	Unless required by applicable law or agreed to in writing, software
-	distributed under the License is distributed on an "AS IS" BASIS,
-	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	See the License for the specific language governing permissions and
-	limitations under the License.
+/*
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
 
 /* global Windows, GlobalizationProxy */
@@ -21,7 +21,7 @@ var decimalFormatter;
 var currencyFormatter;
 var percentFormatter;
 
-function createRoundingAlgorithm() {
+function createRoundingAlgorithm () {
     // This is undefined in case of Windows 8.0
     if (Windows.Globalization.NumberFormatting.IncrementNumberRounder) {
         var rounder = new Windows.Globalization.NumberFormatting.IncrementNumberRounder();
@@ -34,7 +34,7 @@ function createRoundingAlgorithm() {
     return null;
 }
 
-function createDecimalFormatter(regionName) {
+function createDecimalFormatter (regionName) {
     decimalFormatter = new Windows.Globalization.NumberFormatting.DecimalFormatter([locale], regionName);
 
     decimalFormatter.numberRounder = createRoundingAlgorithm();
@@ -43,11 +43,11 @@ function createDecimalFormatter(regionName) {
     return decimalFormatter;
 }
 
-function getDecimalFormatter(regionName) {
+function getDecimalFormatter (regionName) {
     return decimalFormatter || createDecimalFormatter(regionName);
 }
 
-function createCurrencyFormatter(regionName) {
+function createCurrencyFormatter (regionName) {
     var regionObj = new Windows.Globalization.GeographicRegion(regionName);
     var currency = regionObj.currenciesInUse[0];
 
@@ -59,11 +59,11 @@ function createCurrencyFormatter(regionName) {
     return currencyFormatter;
 }
 
-function getCurrencyFormatter(regionName) {
+function getCurrencyFormatter (regionName) {
     return currencyFormatter || createCurrencyFormatter(regionName);
 }
 
-function createPercentFormatter(regionName) {
+function createPercentFormatter (regionName) {
     percentFormatter = new Windows.Globalization.NumberFormatting.PercentFormatter([locale], regionName);
 
     percentFormatter.numberRounder = createRoundingAlgorithm();
@@ -73,11 +73,11 @@ function createPercentFormatter(regionName) {
     return percentFormatter;
 }
 
-function getPercentFormatter(regionName) {
+function getPercentFormatter (regionName) {
     return percentFormatter || createPercentFormatter(regionName);
 }
 
-function getNumberFormatter(options) {
+function getNumberFormatter (options) {
     options = options || { type: 'decimal' };
     options.type = options.type || 'decimal';
 
@@ -85,20 +85,20 @@ function getNumberFormatter(options) {
     var regionName = tags[tags.length - 1];
 
     switch (options.type) {
-        case 'decimal':
-        {
-            return getDecimalFormatter(regionName);
-        }
-        case 'currency':
-        {
-            return getCurrencyFormatter(regionName);
-        }
-        case 'percent':
-        {
-            return getPercentFormatter(regionName);
-        }
-        default:
-            throw "The options.type can be 'decimal', 'percent', or 'currency' only";
+    case 'decimal':
+    {
+        return getDecimalFormatter(regionName);
+    }
+    case 'currency':
+    {
+        return getCurrencyFormatter(regionName);
+    }
+    case 'percent':
+    {
+        return getPercentFormatter(regionName);
+    }
+    default:
+        throw "The options.type can be 'decimal', 'percent', or 'currency' only";
     }
 }
 
@@ -122,15 +122,15 @@ module.exports = {
         tryDoAction(GlobalizationProxy.GlobalizationProxy.dateToString,
             JSON.stringify({
                 date: args[0].date,
-                options: args[0].options || { formatLength: "short", selector: "date and time" }
+                options: args[0].options || { formatLength: 'short', selector: 'date and time' }
             }), win, fail);
     },
 
     stringToDate: function (win, fail, args) {
-        tryDoAction(GlobalizationProxy.GlobalizationProxy.stringToDate, 
+        tryDoAction(GlobalizationProxy.GlobalizationProxy.stringToDate,
             JSON.stringify({
                 dateString: args[0].dateString,
-                options: args[0].options || { formatLength: "short", selector: "date and time" }
+                options: args[0].options || { formatLength: 'short', selector: 'date and time' }
             }), win, fail);
     },
 
@@ -152,20 +152,22 @@ module.exports = {
             } else if (item === 'days' && type === 'narrow') {
                 dayOfWeekFormat = Windows.Globalization.DateTimeFormatting.DayOfWeekFormat.abbreviated;
             } else {
-                throw "Incorrect item type";
+                throw 'Incorrect item type';
             }
 
             var formatter = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter(
                 Windows.Globalization.DateTimeFormatting.YearFormat.none,
-                monthFormat, 
-                Windows.Globalization.DateTimeFormatting.DayFormat.none, 
-                dayOfWeekFormat, 
-                Windows.Globalization.DateTimeFormatting.HourFormat.none, 
-                Windows.Globalization.DateTimeFormatting.MinuteFormat.none, 
-                Windows.Globalization.DateTimeFormatting.SecondFormat.none, 
+                monthFormat,
+                Windows.Globalization.DateTimeFormatting.DayFormat.none,
+                dayOfWeekFormat,
+                Windows.Globalization.DateTimeFormatting.HourFormat.none,
+                Windows.Globalization.DateTimeFormatting.MinuteFormat.none,
+                Windows.Globalization.DateTimeFormatting.SecondFormat.none,
                 [locale]);
 
-            var result = [], i, date;
+            var result = [];
+            var i;
+            var date;
             if (item === 'months') {
                 for (i = 0; i < 12; i++) {
                     date = new Date(2014, i, 20, 0, 0, 0, 0);
@@ -185,9 +187,9 @@ module.exports = {
     },
 
     isDayLightSavingsTime: function (win, fail, args) {
-        tryDoAction(GlobalizationProxy.GlobalizationProxy.isDayLightSavingsTime, 
+        tryDoAction(GlobalizationProxy.GlobalizationProxy.isDayLightSavingsTime,
             JSON.stringify({
-                date: args[0].date,
+                date: args[0].date
             }), win, fail);
     },
 
@@ -200,7 +202,7 @@ module.exports = {
             var formatter = getNumberFormatter(args[0].options);
             var formattedNumber = formatter.format(args[0].number);
             if (!formattedNumber) {
-                 throw 'Unknown error';
+                throw 'Unknown error';
             }
 
             win({ value: formattedNumber });
@@ -214,7 +216,7 @@ module.exports = {
             var formatter = getNumberFormatter(args[0].options);
             var number = formatter.parseDouble(args[0].numberString);
             if (!number) {
-                 throw 'Input string was in incorrect format';
+                throw 'Input string was in incorrect format';
             }
 
             win({ value: number });
@@ -260,11 +262,11 @@ module.exports = {
                 fraction: formatter.fractionDigits,
                 code: formatter.currency,
 
-                //unsupported
+                // unsupported
                 decimal: '',
                 grouping: '',
                 pattern: '',
-                rounding: 0,
+                rounding: 0
             });
         } catch (e) {
             fail(new GlobalizationError(GlobalizationError.PATTERN_ERROR, e));
@@ -272,7 +274,7 @@ module.exports = {
     }
 };
 
-function tryDoAction(action, args, win, fail) {
+function tryDoAction (action, args, win, fail) {
     try {
         var result = action(args);
         var obj = JSON.parse(result);
@@ -283,14 +285,14 @@ function tryDoAction(action, args, win, fail) {
     }
 }
 
-function checkForGlobalizationError(obj) {
+function checkForGlobalizationError (obj) {
     if (obj && 'code' in obj && 'message' in obj) {
         throw new GlobalizationError(obj.code, obj.message);
     }
 }
 
-(function init() {
+(function init () {
     GlobalizationProxy.GlobalizationProxy.setLocale(locale);
 })();
 
-require("cordova/exec/proxy").add("Globalization", module.exports);
\ No newline at end of file
+require('cordova/exec/proxy').add('Globalization', module.exports);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message