@platform/util.value
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -5,1 +5,2 @@ export declare function defaultValue<T>(value: T | undefined, defaultValue?: T): T; | ||
export declare const isStatusOk: (status: number) => boolean; | ||
export declare function plural(count: number, singular: string, plural?: string): string; |
@@ -27,1 +27,6 @@ "use strict"; | ||
}; | ||
function plural(count, singular, plural) { | ||
plural = plural ? plural : singular + "s"; | ||
return count === 1 || count === -1 ? singular : plural; | ||
} | ||
exports.plural = plural; |
@@ -85,1 +85,30 @@ "use strict"; | ||
}); | ||
describe('plural', function () { | ||
it('singular', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
chai_1.expect(_1.value.plural(1, 'item')).to.eql('item'); | ||
chai_1.expect(_1.value.plural(-1, 'item')).to.eql('item'); | ||
chai_1.expect(_1.value.plural(1, 'item', 'items')).to.eql('item'); | ||
chai_1.expect(_1.value.plural(-1, 'item', 'items')).to.eql('item'); | ||
return [2]; | ||
}); | ||
}); }); | ||
it('plural', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
chai_1.expect(_1.value.plural(0, 'item', 'items')).to.eql('items'); | ||
chai_1.expect(_1.value.plural(2, 'item', 'items')).to.eql('items'); | ||
chai_1.expect(_1.value.plural(-2, 'item', 'items')).to.eql('items'); | ||
chai_1.expect(_1.value.plural(999, 'item', 'items')).to.eql('items'); | ||
return [2]; | ||
}); | ||
}); }); | ||
it('inferred "s"', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
chai_1.expect(_1.value.plural(0, 'item')).to.eql('items'); | ||
chai_1.expect(_1.value.plural(2, 'item')).to.eql('items'); | ||
chai_1.expect(_1.value.plural(-2, 'item')).to.eql('items'); | ||
chai_1.expect(_1.value.plural(999, 'item')).to.eql('items'); | ||
return [2]; | ||
}); | ||
}); }); | ||
}); |
{ | ||
"name": "@platform/util.value", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "Helpers for working with, transforming, and formatting values.", | ||
@@ -16,5 +16,5 @@ "main": "lib/index", | ||
"dependencies": { | ||
"@platform/libs": "0.0.3", | ||
"@platform/util.is": "0.0.16", | ||
"@types/semver": "^5.5.0", | ||
"@platform/libs": "0.0.4", | ||
"@platform/util.is": "0.0.17", | ||
"@types/semver": "5.5.0", | ||
"cuid": "2.1.6", | ||
@@ -26,3 +26,3 @@ "dayjs": "1.8.6", | ||
"@platform/test": "0.0.26", | ||
"@platform/ts.cli": "3.3.38", | ||
"@platform/ts.cli": "3.3.39", | ||
"moment": "2.24.0" | ||
@@ -29,0 +29,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108279
2862
+ Added@platform/libs@0.0.4(transitive)
+ Added@platform/util.is@0.0.17(transitive)
+ Added@types/ramda@0.25.50(transitive)
- Removed@platform/libs@0.0.3(transitive)
- Removed@platform/util.is@0.0.16(transitive)
- Removed@types/ramda@0.25.49(transitive)
Updated@platform/libs@0.0.4
Updated@platform/util.is@0.0.17
Updated@types/semver@5.5.0