Skip to content

Commit b42114b

Browse files
committed
Run prettier on the source
1 parent 23c409e commit b42114b

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

lib/index.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use strict";
2-
exports = (module.exports = writtenNumber);
2+
exports = module.exports = writtenNumber;
33
var util = require("./util");
44

55
var languages = ["en", "es", "pt", "fr", "eo", "it", "vi"];
@@ -83,7 +83,8 @@ function writtenNumber(n, options) {
8383

8484
if (m) {
8585
if (
86-
options.noAnd && !(language.andException && language.andException[10])
86+
options.noAnd &&
87+
!(language.andException && language.andException[10])
8788
) {
8889
ret.push(writtenNumber(m, options));
8990
} else {
@@ -108,7 +109,6 @@ function writtenNumber(n, options) {
108109
firstSignificant = scale[i];
109110

110111
if (unit.useBaseInstead) {
111-
112112
var shouldUseBaseException =
113113
unit.useBaseException.indexOf(r) > -1 &&
114114
(unit.useBaseExceptionWhenNoTrailingNumbers
@@ -132,14 +132,16 @@ function writtenNumber(n, options) {
132132
}
133133

134134
if (
135-
unit.avoidPrefixException && unit.avoidPrefixException.indexOf(r) > -1
135+
unit.avoidPrefixException &&
136+
unit.avoidPrefixException.indexOf(r) > -1
136137
) {
137138
ret.push(str);
138139
continue;
139140
}
140141

141142
var exception = language.unitExceptions[r];
142-
var number = exception ||
143+
var number =
144+
exception ||
143145
writtenNumber(
144146
r,
145147
util.defaults(
@@ -155,14 +157,18 @@ function writtenNumber(n, options) {
155157
ret.push(number + " " + str);
156158
}
157159

158-
var firstSignificantN = (firstSignificant * Math.floor(n / firstSignificant));
160+
var firstSignificantN = firstSignificant * Math.floor(n / firstSignificant);
159161
var rest = n - firstSignificantN;
160162

161-
if (language.andWhenTrailing &&
162-
firstSignificant &&
163-
0 < rest &&
164-
ret[0].indexOf(language.unitSeparator) !== 0) {
165-
ret = [ret[0], language.unitSeparator.replace(/\s+$/, '')].concat(ret.slice(1));
163+
if (
164+
language.andWhenTrailing &&
165+
firstSignificant &&
166+
0 < rest &&
167+
ret[0].indexOf(language.unitSeparator) !== 0
168+
) {
169+
ret = [ret[0], language.unitSeparator.replace(/\s+$/, "")].concat(
170+
ret.slice(1)
171+
);
166172
}
167173

168174
return ret.reverse().join(" ");
@@ -172,9 +178,9 @@ function handleSmallerThan100(n, language, unit, baseCardinals, options) {
172178
var dec = Math.floor(n / 10) * 10;
173179
unit = n - dec;
174180
if (unit) {
175-
return baseCardinals[dec] +
176-
language.baseSeparator +
177-
writtenNumber(unit, options);
181+
return (
182+
baseCardinals[dec] + language.baseSeparator + writtenNumber(unit, options)
183+
);
178184
}
179185
return baseCardinals[dec];
180186
}

lib/util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict';
1+
"use strict";
22
/**
33
* Merges a set of default keys with a target object
44
* (Like _.defaults, but will also extend onto null/undefined)
@@ -9,10 +9,10 @@
99
*/
1010

1111
function defaults(target, defs) {
12-
if(target == null) target = {};
12+
if (target == null) target = {};
1313
var ret = {};
1414
var keys = Object.keys(defs);
15-
for(var i = 0, len = keys.length; i < len; i++) {
15+
for (var i = 0, len = keys.length; i < len; i++) {
1616
var key = keys[i];
1717
ret[key] = target[key] || defs[key];
1818
}

0 commit comments

Comments
 (0)