From 253bb00c2c514c36e1ac27cc0ecf88fe9214e9ed Mon Sep 17 00:00:00 2001 From: Gilmore Davidson Date: Sun, 4 Feb 2024 15:29:51 +1100 Subject: [PATCH] Add editorconfig file for consistent indentation --- .editorconfig | 22 ++++++++++++++++++++++ moment-timezone-utils.js | 10 +++++----- moment-timezone.js | 6 +++--- 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..0a78996f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.min.js] +insert_final_newline = false + +# It's not ideal to have 2 different styles, but this is just codifying what +# already existed in the project. +[*.{md,ts}] +indent_style = space + +# Standard style for GitHub workflow files +[*.yml] +indent_style = space +indent_size = 2 diff --git a/moment-timezone-utils.js b/moment-timezone-utils.js index 871ffa4a..4d66661c 100644 --- a/moment-timezone-utils.js +++ b/moment-timezone-utils.js @@ -8,9 +8,9 @@ "use strict"; /*global define*/ - if (typeof module === 'object' && module.exports) { - module.exports = factory(require('./')); // Node - } else if (typeof define === 'function' && define.amd) { + if (typeof module === 'object' && module.exports) { + module.exports = factory(require('./')); // Node + } else if (typeof define === 'function' && define.amd) { define(['moment'], factory); // AMD } else { factory(root.moment); // Browser @@ -201,8 +201,8 @@ if (a.population > b.population) { group.unshift(a); } else if (a.population === b.population && groupLeaders && groupLeaders[a.name]) { - group.unshift(a); - } else { + group.unshift(a); + } else { group.push(a); } foundGroup = true; diff --git a/moment-timezone.js b/moment-timezone.js index 8123828d..46e33ad3 100644 --- a/moment-timezone.js +++ b/moment-timezone.js @@ -159,10 +159,10 @@ } else if (num >= arr[len - 1]) { return -1; } - + var mid; var lo = 0; - var hi = len - 1; + var hi = len - 1; while (hi - lo > 1) { mid = Math.floor((lo + hi) / 2); if (arr[mid] <= num) { @@ -173,7 +173,7 @@ } return hi; } - + Zone.prototype = { _set : function (unpacked) { this.name = unpacked.name;