kui-utils 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -42,7 +42,7 @@ declare const copyInfo: (data?: string | undefined) => void;
42
42
 
43
43
  declare const cropText: (text: string, limit: number) => string;
44
44
 
45
- declare const declineByNumber: (num: number | null, titles: string[]) => string;
45
+ declare const declineByNumber: (num: number | null, titles: string[], withoutNumber?: boolean | undefined) => string;
46
46
 
47
47
  declare const formatError: (data: ObjectType | null) => string;
48
48
 
package/index.js CHANGED
@@ -240,9 +240,9 @@ var cropText = function (text, limit) {
240
240
  };
241
241
 
242
242
  var cases = [2, 0, 1, 1, 1, 2];
243
- var declineByNumber = function (num, titles) {
244
- return num
245
- ? "".concat(num, " ").concat(titles[num % 100 > 4 && num % 100 < 20
243
+ var declineByNumber = function (num, titles, withoutNumber) {
244
+ return typeof num === "number"
245
+ ? "".concat(withoutNumber ? "" : "".concat(num, " ")).concat(titles[num % 100 > 4 && num % 100 < 20
246
246
  ? 2
247
247
  : cases[num % 10 < 5 ? num % 10 : 5]])
248
248
  : "";