@utilix-tech/sdk 0.22.0 → 0.23.0
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/CHANGELOG.md +4 -0
- package/README.md +6 -2
- package/dist/{chunk-TLRSQHMP.js → chunk-AIKSKJ77.js} +71 -1
- package/dist/index.cjs +70 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tools/units.cjs +70 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-KrjRyu0w.d.cts → units-h4rHQGp5.d.cts} +45 -2
- package/dist/{units-KrjRyu0w.d.ts → units-h4rHQGp5.d.ts} +45 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.23.0
|
|
6
|
+
- Add `calculateMarginMarkup` (margin-markup-calculator): given exactly two of cost, price, margin percent, and markup percent, solve for the other two plus the gross profit.
|
|
7
|
+
- Add `marginToMarkup` / `markupToMargin` helpers for converting between the two percentage bases.
|
|
8
|
+
|
|
5
9
|
## 0.22.0
|
|
6
10
|
- Add `convertAprApy` (apr-apy-converter): convert between a nominal APR and effective APY for a given compounding frequency, in both directions.
|
|
7
11
|
- Add `parseIso8601Duration` / `formatIso8601Duration` (iso8601-duration): parse an ISO 8601 duration into components and total seconds, or format seconds into a canonical duration string.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**564 developer utility functions for Node.js: runs locally, no API key required.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
@@ -261,7 +261,7 @@ formatIso8601Duration(90061); // { iso: "P1DT1H1M1S", ... }
|
|
|
261
261
|
### `/units`: Conversions
|
|
262
262
|
|
|
263
263
|
```ts
|
|
264
|
-
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy } from "@utilix-tech/sdk/units";
|
|
264
|
+
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy, calculateMarginMarkup } from "@utilix-tech/sdk/units";
|
|
265
265
|
|
|
266
266
|
// File sizes
|
|
267
267
|
convertBytes(1073741824, "GB"); // 1
|
|
@@ -327,6 +327,10 @@ calculatePercentageChange(200, 250);
|
|
|
327
327
|
// APR <-> APY conversion for a given compounding frequency
|
|
328
328
|
convertAprApy(12, 12, "apr-to-apy");
|
|
329
329
|
// { apr: 12, apy: 12.682503, difference: 0.682503, compoundsPerYear: 12, ... }
|
|
330
|
+
|
|
331
|
+
// Margin/markup: pass any TWO of cost, price, marginPercent, markupPercent
|
|
332
|
+
calculateMarginMarkup({ cost: 80, price: 100 });
|
|
333
|
+
// { cost: 80, price: 100, profit: 20, marginPercent: 20, markupPercent: 25, ... }
|
|
330
334
|
```
|
|
331
335
|
|
|
332
336
|
---
|
|
@@ -20,6 +20,7 @@ __export(units_exports, {
|
|
|
20
20
|
calcSubnet: () => calcSubnet,
|
|
21
21
|
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
22
22
|
calculateLoan: () => calculateLoan,
|
|
23
|
+
calculateMarginMarkup: () => calculateMarginMarkup,
|
|
23
24
|
calculatePercentageChange: () => calculatePercentageChange,
|
|
24
25
|
calculateSimpleInterest: () => calculateSimpleInterest,
|
|
25
26
|
calculateTax: () => calculateTax,
|
|
@@ -52,6 +53,8 @@ __export(units_exports, {
|
|
|
52
53
|
isValidCidr: () => isValidCidr,
|
|
53
54
|
isValidIp: () => isValidIp,
|
|
54
55
|
isValidIpv4: () => isValidIpv4,
|
|
56
|
+
marginToMarkup: () => marginToMarkup,
|
|
57
|
+
markupToMargin: () => markupToMargin,
|
|
55
58
|
octalToPermissions: () => octalToPermissions,
|
|
56
59
|
parseFileSize: () => parseFileSize,
|
|
57
60
|
parseInput: () => parseInput,
|
|
@@ -1394,5 +1397,72 @@ function convertAprApy(rate, compoundsPerYear, direction) {
|
|
|
1394
1397
|
difference: round6(apy - apr)
|
|
1395
1398
|
};
|
|
1396
1399
|
}
|
|
1400
|
+
var _MARGIN_FIELDS = ["cost", "price", "marginPercent", "markupPercent"];
|
|
1401
|
+
function calculateMarginMarkup(input) {
|
|
1402
|
+
const provided = (v) => typeof v === "number" && Number.isFinite(v);
|
|
1403
|
+
const given = _MARGIN_FIELDS.filter((f) => provided(input[f]));
|
|
1404
|
+
if (given.length !== 2) {
|
|
1405
|
+
return { error: `Provide exactly two of cost, price, marginPercent, markupPercent (got ${given.length})` };
|
|
1406
|
+
}
|
|
1407
|
+
const has = (f) => given.includes(f);
|
|
1408
|
+
const cost0 = input.cost;
|
|
1409
|
+
const price0 = input.price;
|
|
1410
|
+
const margin0 = input.marginPercent;
|
|
1411
|
+
const markup0 = input.markupPercent;
|
|
1412
|
+
if (has("cost") && cost0 <= 0) return { error: "Cost must be greater than zero" };
|
|
1413
|
+
if (has("price") && price0 <= 0) return { error: "Price must be greater than zero" };
|
|
1414
|
+
if (has("marginPercent") && margin0 >= 100) {
|
|
1415
|
+
return { error: "Margin percent must be below 100 (a 100% margin implies a zero cost)" };
|
|
1416
|
+
}
|
|
1417
|
+
if (has("markupPercent") && markup0 <= -100) {
|
|
1418
|
+
return { error: "Markup percent must be greater than -100" };
|
|
1419
|
+
}
|
|
1420
|
+
let cost;
|
|
1421
|
+
let price;
|
|
1422
|
+
if (has("cost") && has("price")) {
|
|
1423
|
+
cost = cost0;
|
|
1424
|
+
price = price0;
|
|
1425
|
+
} else if (has("cost") && has("marginPercent")) {
|
|
1426
|
+
cost = cost0;
|
|
1427
|
+
price = cost0 / (1 - margin0 / 100);
|
|
1428
|
+
} else if (has("cost") && has("markupPercent")) {
|
|
1429
|
+
cost = cost0;
|
|
1430
|
+
price = cost0 * (1 + markup0 / 100);
|
|
1431
|
+
} else if (has("price") && has("marginPercent")) {
|
|
1432
|
+
price = price0;
|
|
1433
|
+
cost = price0 * (1 - margin0 / 100);
|
|
1434
|
+
} else if (has("price") && has("markupPercent")) {
|
|
1435
|
+
price = price0;
|
|
1436
|
+
cost = price0 / (1 + markup0 / 100);
|
|
1437
|
+
} else {
|
|
1438
|
+
return { error: "Margin and markup alone cannot be solved: also provide a cost or a price" };
|
|
1439
|
+
}
|
|
1440
|
+
if (!Number.isFinite(cost) || !Number.isFinite(price)) return { error: "Inputs produce a non-finite result" };
|
|
1441
|
+
if (cost <= 0) return { error: "Those inputs imply a cost of zero or less" };
|
|
1442
|
+
if (price <= 0) return { error: "Those inputs imply a price of zero or less" };
|
|
1443
|
+
const round4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
1444
|
+
const profit = price - cost;
|
|
1445
|
+
return {
|
|
1446
|
+
cost: round4(cost),
|
|
1447
|
+
price: round4(price),
|
|
1448
|
+
profit: round4(profit),
|
|
1449
|
+
marginPercent: round4(profit / price * 100),
|
|
1450
|
+
markupPercent: round4(profit / cost * 100),
|
|
1451
|
+
given,
|
|
1452
|
+
solvedFor: _MARGIN_FIELDS.filter((f) => !given.includes(f))
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
function marginToMarkup(marginPercent) {
|
|
1456
|
+
if (!Number.isFinite(marginPercent) || marginPercent >= 100) {
|
|
1457
|
+
return { error: "Margin percent must be a finite number below 100" };
|
|
1458
|
+
}
|
|
1459
|
+
return Math.round(marginPercent / (100 - marginPercent) * 100 * 1e4) / 1e4;
|
|
1460
|
+
}
|
|
1461
|
+
function markupToMargin(markupPercent) {
|
|
1462
|
+
if (!Number.isFinite(markupPercent) || markupPercent <= -100) {
|
|
1463
|
+
return { error: "Markup percent must be a finite number greater than -100" };
|
|
1464
|
+
}
|
|
1465
|
+
return Math.round(markupPercent / (100 + markupPercent) * 100 * 1e4) / 1e4;
|
|
1466
|
+
}
|
|
1397
1467
|
|
|
1398
|
-
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateCompoundInterest, calculateLoan, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
|
|
1468
|
+
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateCompoundInterest, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
|
package/dist/index.cjs
CHANGED
|
@@ -6930,6 +6930,7 @@ __export(units_exports, {
|
|
|
6930
6930
|
calcSubnet: () => calcSubnet,
|
|
6931
6931
|
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
6932
6932
|
calculateLoan: () => calculateLoan,
|
|
6933
|
+
calculateMarginMarkup: () => calculateMarginMarkup,
|
|
6933
6934
|
calculatePercentageChange: () => calculatePercentageChange,
|
|
6934
6935
|
calculateSimpleInterest: () => calculateSimpleInterest,
|
|
6935
6936
|
calculateTax: () => calculateTax,
|
|
@@ -6962,6 +6963,8 @@ __export(units_exports, {
|
|
|
6962
6963
|
isValidCidr: () => isValidCidr,
|
|
6963
6964
|
isValidIp: () => isValidIp,
|
|
6964
6965
|
isValidIpv4: () => isValidIpv4,
|
|
6966
|
+
marginToMarkup: () => marginToMarkup,
|
|
6967
|
+
markupToMargin: () => markupToMargin,
|
|
6965
6968
|
octalToPermissions: () => octalToPermissions,
|
|
6966
6969
|
parseFileSize: () => parseFileSize,
|
|
6967
6970
|
parseInput: () => parseInput,
|
|
@@ -8304,6 +8307,73 @@ function convertAprApy(rate, compoundsPerYear, direction) {
|
|
|
8304
8307
|
difference: round6(apy - apr)
|
|
8305
8308
|
};
|
|
8306
8309
|
}
|
|
8310
|
+
var _MARGIN_FIELDS = ["cost", "price", "marginPercent", "markupPercent"];
|
|
8311
|
+
function calculateMarginMarkup(input) {
|
|
8312
|
+
const provided = (v) => typeof v === "number" && Number.isFinite(v);
|
|
8313
|
+
const given = _MARGIN_FIELDS.filter((f) => provided(input[f]));
|
|
8314
|
+
if (given.length !== 2) {
|
|
8315
|
+
return { error: `Provide exactly two of cost, price, marginPercent, markupPercent (got ${given.length})` };
|
|
8316
|
+
}
|
|
8317
|
+
const has = (f) => given.includes(f);
|
|
8318
|
+
const cost0 = input.cost;
|
|
8319
|
+
const price0 = input.price;
|
|
8320
|
+
const margin0 = input.marginPercent;
|
|
8321
|
+
const markup0 = input.markupPercent;
|
|
8322
|
+
if (has("cost") && cost0 <= 0) return { error: "Cost must be greater than zero" };
|
|
8323
|
+
if (has("price") && price0 <= 0) return { error: "Price must be greater than zero" };
|
|
8324
|
+
if (has("marginPercent") && margin0 >= 100) {
|
|
8325
|
+
return { error: "Margin percent must be below 100 (a 100% margin implies a zero cost)" };
|
|
8326
|
+
}
|
|
8327
|
+
if (has("markupPercent") && markup0 <= -100) {
|
|
8328
|
+
return { error: "Markup percent must be greater than -100" };
|
|
8329
|
+
}
|
|
8330
|
+
let cost;
|
|
8331
|
+
let price;
|
|
8332
|
+
if (has("cost") && has("price")) {
|
|
8333
|
+
cost = cost0;
|
|
8334
|
+
price = price0;
|
|
8335
|
+
} else if (has("cost") && has("marginPercent")) {
|
|
8336
|
+
cost = cost0;
|
|
8337
|
+
price = cost0 / (1 - margin0 / 100);
|
|
8338
|
+
} else if (has("cost") && has("markupPercent")) {
|
|
8339
|
+
cost = cost0;
|
|
8340
|
+
price = cost0 * (1 + markup0 / 100);
|
|
8341
|
+
} else if (has("price") && has("marginPercent")) {
|
|
8342
|
+
price = price0;
|
|
8343
|
+
cost = price0 * (1 - margin0 / 100);
|
|
8344
|
+
} else if (has("price") && has("markupPercent")) {
|
|
8345
|
+
price = price0;
|
|
8346
|
+
cost = price0 / (1 + markup0 / 100);
|
|
8347
|
+
} else {
|
|
8348
|
+
return { error: "Margin and markup alone cannot be solved: also provide a cost or a price" };
|
|
8349
|
+
}
|
|
8350
|
+
if (!Number.isFinite(cost) || !Number.isFinite(price)) return { error: "Inputs produce a non-finite result" };
|
|
8351
|
+
if (cost <= 0) return { error: "Those inputs imply a cost of zero or less" };
|
|
8352
|
+
if (price <= 0) return { error: "Those inputs imply a price of zero or less" };
|
|
8353
|
+
const round4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
8354
|
+
const profit = price - cost;
|
|
8355
|
+
return {
|
|
8356
|
+
cost: round4(cost),
|
|
8357
|
+
price: round4(price),
|
|
8358
|
+
profit: round4(profit),
|
|
8359
|
+
marginPercent: round4(profit / price * 100),
|
|
8360
|
+
markupPercent: round4(profit / cost * 100),
|
|
8361
|
+
given,
|
|
8362
|
+
solvedFor: _MARGIN_FIELDS.filter((f) => !given.includes(f))
|
|
8363
|
+
};
|
|
8364
|
+
}
|
|
8365
|
+
function marginToMarkup(marginPercent) {
|
|
8366
|
+
if (!Number.isFinite(marginPercent) || marginPercent >= 100) {
|
|
8367
|
+
return { error: "Margin percent must be a finite number below 100" };
|
|
8368
|
+
}
|
|
8369
|
+
return Math.round(marginPercent / (100 - marginPercent) * 100 * 1e4) / 1e4;
|
|
8370
|
+
}
|
|
8371
|
+
function markupToMargin(markupPercent) {
|
|
8372
|
+
if (!Number.isFinite(markupPercent) || markupPercent <= -100) {
|
|
8373
|
+
return { error: "Markup percent must be a finite number greater than -100" };
|
|
8374
|
+
}
|
|
8375
|
+
return Math.round(markupPercent / (100 + markupPercent) * 100 * 1e4) / 1e4;
|
|
8376
|
+
}
|
|
8307
8377
|
|
|
8308
8378
|
// src/tools/network.ts
|
|
8309
8379
|
var network_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ export { t as text } from './text-DS70aMY5.cjs';
|
|
|
5
5
|
export { d as data } from './data-D8XTI7Du.cjs';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-h4rHQGp5.cjs';
|
|
9
9
|
export { n as network } from './network-BJOjJnmY.cjs';
|
|
10
10
|
export { a as api } from './api-Xl7OzIgq.cjs';
|
|
11
11
|
export { c as code } from './code-DaRvff2v.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { t as text } from './text-DS70aMY5.js';
|
|
|
5
5
|
export { d as data } from './data-D8XTI7Du.js';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-h4rHQGp5.js';
|
|
9
9
|
export { n as network } from './network-BJOjJnmY.js';
|
|
10
10
|
export { a as api } from './api-Xl7OzIgq.js';
|
|
11
11
|
export { c as code } from './code-DaRvff2v.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-XMKJYVKB.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-AIKSKJ77.js';
|
|
3
3
|
export { network_exports as network } from './chunk-Y5OOP6WN.js';
|
|
4
4
|
export { api_exports as api } from './chunk-Q3B3YWOA.js';
|
|
5
5
|
export { code_exports as code } from './chunk-LXKIPPDG.js';
|
package/dist/tools/units.cjs
CHANGED
|
@@ -1319,6 +1319,73 @@ function convertAprApy(rate, compoundsPerYear, direction) {
|
|
|
1319
1319
|
difference: round6(apy - apr)
|
|
1320
1320
|
};
|
|
1321
1321
|
}
|
|
1322
|
+
var _MARGIN_FIELDS = ["cost", "price", "marginPercent", "markupPercent"];
|
|
1323
|
+
function calculateMarginMarkup(input) {
|
|
1324
|
+
const provided = (v) => typeof v === "number" && Number.isFinite(v);
|
|
1325
|
+
const given = _MARGIN_FIELDS.filter((f) => provided(input[f]));
|
|
1326
|
+
if (given.length !== 2) {
|
|
1327
|
+
return { error: `Provide exactly two of cost, price, marginPercent, markupPercent (got ${given.length})` };
|
|
1328
|
+
}
|
|
1329
|
+
const has = (f) => given.includes(f);
|
|
1330
|
+
const cost0 = input.cost;
|
|
1331
|
+
const price0 = input.price;
|
|
1332
|
+
const margin0 = input.marginPercent;
|
|
1333
|
+
const markup0 = input.markupPercent;
|
|
1334
|
+
if (has("cost") && cost0 <= 0) return { error: "Cost must be greater than zero" };
|
|
1335
|
+
if (has("price") && price0 <= 0) return { error: "Price must be greater than zero" };
|
|
1336
|
+
if (has("marginPercent") && margin0 >= 100) {
|
|
1337
|
+
return { error: "Margin percent must be below 100 (a 100% margin implies a zero cost)" };
|
|
1338
|
+
}
|
|
1339
|
+
if (has("markupPercent") && markup0 <= -100) {
|
|
1340
|
+
return { error: "Markup percent must be greater than -100" };
|
|
1341
|
+
}
|
|
1342
|
+
let cost;
|
|
1343
|
+
let price;
|
|
1344
|
+
if (has("cost") && has("price")) {
|
|
1345
|
+
cost = cost0;
|
|
1346
|
+
price = price0;
|
|
1347
|
+
} else if (has("cost") && has("marginPercent")) {
|
|
1348
|
+
cost = cost0;
|
|
1349
|
+
price = cost0 / (1 - margin0 / 100);
|
|
1350
|
+
} else if (has("cost") && has("markupPercent")) {
|
|
1351
|
+
cost = cost0;
|
|
1352
|
+
price = cost0 * (1 + markup0 / 100);
|
|
1353
|
+
} else if (has("price") && has("marginPercent")) {
|
|
1354
|
+
price = price0;
|
|
1355
|
+
cost = price0 * (1 - margin0 / 100);
|
|
1356
|
+
} else if (has("price") && has("markupPercent")) {
|
|
1357
|
+
price = price0;
|
|
1358
|
+
cost = price0 / (1 + markup0 / 100);
|
|
1359
|
+
} else {
|
|
1360
|
+
return { error: "Margin and markup alone cannot be solved: also provide a cost or a price" };
|
|
1361
|
+
}
|
|
1362
|
+
if (!Number.isFinite(cost) || !Number.isFinite(price)) return { error: "Inputs produce a non-finite result" };
|
|
1363
|
+
if (cost <= 0) return { error: "Those inputs imply a cost of zero or less" };
|
|
1364
|
+
if (price <= 0) return { error: "Those inputs imply a price of zero or less" };
|
|
1365
|
+
const round4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
1366
|
+
const profit = price - cost;
|
|
1367
|
+
return {
|
|
1368
|
+
cost: round4(cost),
|
|
1369
|
+
price: round4(price),
|
|
1370
|
+
profit: round4(profit),
|
|
1371
|
+
marginPercent: round4(profit / price * 100),
|
|
1372
|
+
markupPercent: round4(profit / cost * 100),
|
|
1373
|
+
given,
|
|
1374
|
+
solvedFor: _MARGIN_FIELDS.filter((f) => !given.includes(f))
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
function marginToMarkup(marginPercent) {
|
|
1378
|
+
if (!Number.isFinite(marginPercent) || marginPercent >= 100) {
|
|
1379
|
+
return { error: "Margin percent must be a finite number below 100" };
|
|
1380
|
+
}
|
|
1381
|
+
return Math.round(marginPercent / (100 - marginPercent) * 100 * 1e4) / 1e4;
|
|
1382
|
+
}
|
|
1383
|
+
function markupToMargin(markupPercent) {
|
|
1384
|
+
if (!Number.isFinite(markupPercent) || markupPercent <= -100) {
|
|
1385
|
+
return { error: "Markup percent must be a finite number greater than -100" };
|
|
1386
|
+
}
|
|
1387
|
+
return Math.round(markupPercent / (100 + markupPercent) * 100 * 1e4) / 1e4;
|
|
1388
|
+
}
|
|
1322
1389
|
|
|
1323
1390
|
exports.BASE_LABELS = BASE_LABELS;
|
|
1324
1391
|
exports.BASE_PREFIXES = BASE_PREFIXES;
|
|
@@ -1337,6 +1404,7 @@ exports.calcAspectRatio = calcAspectRatio;
|
|
|
1337
1404
|
exports.calcSubnet = calcSubnet;
|
|
1338
1405
|
exports.calculateCompoundInterest = calculateCompoundInterest;
|
|
1339
1406
|
exports.calculateLoan = calculateLoan;
|
|
1407
|
+
exports.calculateMarginMarkup = calculateMarginMarkup;
|
|
1340
1408
|
exports.calculatePercentageChange = calculatePercentageChange;
|
|
1341
1409
|
exports.calculateSimpleInterest = calculateSimpleInterest;
|
|
1342
1410
|
exports.calculateTax = calculateTax;
|
|
@@ -1369,6 +1437,8 @@ exports.isValid = isValid;
|
|
|
1369
1437
|
exports.isValidCidr = isValidCidr;
|
|
1370
1438
|
exports.isValidIp = isValidIp;
|
|
1371
1439
|
exports.isValidIpv4 = isValidIpv4;
|
|
1440
|
+
exports.marginToMarkup = marginToMarkup;
|
|
1441
|
+
exports.markupToMargin = markupToMargin;
|
|
1372
1442
|
exports.octalToPermissions = octalToPermissions;
|
|
1373
1443
|
exports.parseFileSize = parseFileSize;
|
|
1374
1444
|
exports.parseInput = parseInput;
|
package/dist/tools/units.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as ByteConvertResult, j as ByteUnit, C as COMMON_CURRENCIES, k as COMMON_LOCALES, l as COMMON_PERMISSIONS, m as COMMON_RATIOS, n as COMMON_SIZES, o as COMMON_TAX_RATES, p as COMMON_TIP_PERCENTAGES, q as COMMON_VIEWPORTS, r as CardValidationResult, s as CompoundInterestResult, t as CompoundYearRow, D as Dimensions, F as FilePermissions, v as FormatOptions, I as IbanValidationResult, w as IpConversion, x as IsbnFormat, y as IsbnResult, L as LoanResult, N as NotationStyle,
|
|
1
|
+
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as ByteConvertResult, j as ByteUnit, C as COMMON_CURRENCIES, k as COMMON_LOCALES, l as COMMON_PERMISSIONS, m as COMMON_RATIOS, n as COMMON_SIZES, o as COMMON_TAX_RATES, p as COMMON_TIP_PERCENTAGES, q as COMMON_VIEWPORTS, r as CardValidationResult, s as CompoundInterestResult, t as CompoundYearRow, D as Dimensions, F as FilePermissions, v as FormatOptions, I as IbanValidationResult, w as IpConversion, x as IsbnFormat, y as IsbnResult, L as LoanResult, M as MarginMarkupField, z as MarginMarkupInput, E as MarginMarkupResult, N as NotationStyle, G as NumberBase, P as PercentChangeDirection, H as PercentageChangeResult, J as Permission, K as PxConvertResult, S as SemverVersion, O as SimpleInterestResult, Q as SubnetInfo, T as TaxDirection, R as TaxResult, U as TimeValueDirection, V as TimeValueResult, W as TipSplitResult, X as ViewportConvertResult, Y as autoFormat, Z as bumpVersion, _ as calcAspectRatio, $ as calcSubnet, a0 as calculateCompoundInterest, a1 as calculateLoan, a2 as calculateMarginMarkup, a3 as calculatePercentageChange, a4 as calculateSimpleInterest, a5 as calculateTax, a6 as calculateTimeValue, a7 as calculateTipSplit, a8 as compareSemver, a9 as convert, aa as convertAprApy, ab as convertBytes, ac as convertIp, ad as coverBox, ae as decimalToIp, af as decimalToIpCidr, ag as describePermissions, ah as fitIntoBox, ai as formatNumber, aj as formatValue, ak as formatVwValue, al as formatWithSeparator, am as gcd, an as ipFromBinary, ao as ipFromDecimal, ap as ipFromHex, aq as ipToBinary, ar as ipToDecimal, as as ipToDecimalCidr, at as ipToHex, au as ipToOctal, av as isValid, aw as isValidCidr, ax as isValidIp, ay as isValidIpv4, az as marginToMarkup, aA as markupToMargin, aB as octalToPermissions, aC as parseFileSize, aD as parseInput, aE as parseNumberString, aF as parseSemver, aG as permissionsToChmod, aH as permissionsToOctal, aI as permissionsToSymbolic, aJ as ptToPx, aK as pxToAll, aL as pxToViewport, aM as remToPx, aN as satisfiesRange, aO as scaleByHeight, aP as scaleByWidth, aQ as sortVersions, aR as splitSubnet, aS as symbolicToPermissions, aT as validateBarcode, aU as validateCardNumber, aV as validateIban, aW as validateIsbn, aX as viewportToPx } from '../units-h4rHQGp5.cjs';
|
package/dist/tools/units.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as ByteConvertResult, j as ByteUnit, C as COMMON_CURRENCIES, k as COMMON_LOCALES, l as COMMON_PERMISSIONS, m as COMMON_RATIOS, n as COMMON_SIZES, o as COMMON_TAX_RATES, p as COMMON_TIP_PERCENTAGES, q as COMMON_VIEWPORTS, r as CardValidationResult, s as CompoundInterestResult, t as CompoundYearRow, D as Dimensions, F as FilePermissions, v as FormatOptions, I as IbanValidationResult, w as IpConversion, x as IsbnFormat, y as IsbnResult, L as LoanResult, N as NotationStyle,
|
|
1
|
+
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as ByteConvertResult, j as ByteUnit, C as COMMON_CURRENCIES, k as COMMON_LOCALES, l as COMMON_PERMISSIONS, m as COMMON_RATIOS, n as COMMON_SIZES, o as COMMON_TAX_RATES, p as COMMON_TIP_PERCENTAGES, q as COMMON_VIEWPORTS, r as CardValidationResult, s as CompoundInterestResult, t as CompoundYearRow, D as Dimensions, F as FilePermissions, v as FormatOptions, I as IbanValidationResult, w as IpConversion, x as IsbnFormat, y as IsbnResult, L as LoanResult, M as MarginMarkupField, z as MarginMarkupInput, E as MarginMarkupResult, N as NotationStyle, G as NumberBase, P as PercentChangeDirection, H as PercentageChangeResult, J as Permission, K as PxConvertResult, S as SemverVersion, O as SimpleInterestResult, Q as SubnetInfo, T as TaxDirection, R as TaxResult, U as TimeValueDirection, V as TimeValueResult, W as TipSplitResult, X as ViewportConvertResult, Y as autoFormat, Z as bumpVersion, _ as calcAspectRatio, $ as calcSubnet, a0 as calculateCompoundInterest, a1 as calculateLoan, a2 as calculateMarginMarkup, a3 as calculatePercentageChange, a4 as calculateSimpleInterest, a5 as calculateTax, a6 as calculateTimeValue, a7 as calculateTipSplit, a8 as compareSemver, a9 as convert, aa as convertAprApy, ab as convertBytes, ac as convertIp, ad as coverBox, ae as decimalToIp, af as decimalToIpCidr, ag as describePermissions, ah as fitIntoBox, ai as formatNumber, aj as formatValue, ak as formatVwValue, al as formatWithSeparator, am as gcd, an as ipFromBinary, ao as ipFromDecimal, ap as ipFromHex, aq as ipToBinary, ar as ipToDecimal, as as ipToDecimalCidr, at as ipToHex, au as ipToOctal, av as isValid, aw as isValidCidr, ax as isValidIp, ay as isValidIpv4, az as marginToMarkup, aA as markupToMargin, aB as octalToPermissions, aC as parseFileSize, aD as parseInput, aE as parseNumberString, aF as parseSemver, aG as permissionsToChmod, aH as permissionsToOctal, aI as permissionsToSymbolic, aJ as ptToPx, aK as pxToAll, aL as pxToViewport, aM as remToPx, aN as satisfiesRange, aO as scaleByHeight, aP as scaleByWidth, aQ as sortVersions, aR as splitSubnet, aS as symbolicToPermissions, aT as validateBarcode, aU as validateCardNumber, aV as validateIban, aW as validateIsbn, aX as viewportToPx } from '../units-h4rHQGp5.js';
|
package/dist/tools/units.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateCompoundInterest, calculateLoan, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx } from '../chunk-
|
|
1
|
+
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateCompoundInterest, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx } from '../chunk-AIKSKJ77.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* - present-value-calculator : calculateTimeValue
|
|
25
25
|
* - percentage-change-calculator : calculatePercentageChange
|
|
26
26
|
* - apr-apy-converter : convertAprApy
|
|
27
|
+
* - margin-markup-calculator : calculateMarginMarkup, marginToMarkup, markupToMargin
|
|
27
28
|
*/
|
|
28
29
|
interface PxConvertResult {
|
|
29
30
|
px: number;
|
|
@@ -474,6 +475,42 @@ interface AprApyResult {
|
|
|
474
475
|
declare function convertAprApy(rate: number, compoundsPerYear: number, direction: AprApyDirection): AprApyResult | {
|
|
475
476
|
error: string;
|
|
476
477
|
};
|
|
478
|
+
type MarginMarkupField = "cost" | "price" | "marginPercent" | "markupPercent";
|
|
479
|
+
interface MarginMarkupInput {
|
|
480
|
+
cost?: number | null;
|
|
481
|
+
price?: number | null;
|
|
482
|
+
marginPercent?: number | null;
|
|
483
|
+
markupPercent?: number | null;
|
|
484
|
+
}
|
|
485
|
+
interface MarginMarkupResult {
|
|
486
|
+
cost: number;
|
|
487
|
+
price: number;
|
|
488
|
+
profit: number;
|
|
489
|
+
marginPercent: number;
|
|
490
|
+
markupPercent: number;
|
|
491
|
+
given: MarginMarkupField[];
|
|
492
|
+
solvedFor: MarginMarkupField[];
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Solve a pricing triangle: given exactly two of cost, price, gross margin
|
|
496
|
+
* percent, and markup percent, derive the other two. Margin is profit as a
|
|
497
|
+
* share of the selling price (profit / price) while markup is profit as a
|
|
498
|
+
* share of the cost (profit / cost), so a 20% margin is the same deal as a
|
|
499
|
+
* 25% markup — conflating them is the classic mistake this exists to avoid.
|
|
500
|
+
* Margin plus markup alone cannot be solved, since neither carries an
|
|
501
|
+
* absolute amount. Pure closed-form arithmetic, no live price feed.
|
|
502
|
+
*/
|
|
503
|
+
declare function calculateMarginMarkup(input: MarginMarkupInput): MarginMarkupResult | {
|
|
504
|
+
error: string;
|
|
505
|
+
};
|
|
506
|
+
/** Markup percent that produces a given gross margin percent (margin < 100). */
|
|
507
|
+
declare function marginToMarkup(marginPercent: number): number | {
|
|
508
|
+
error: string;
|
|
509
|
+
};
|
|
510
|
+
/** Gross margin percent that results from a given markup percent (markup > -100). */
|
|
511
|
+
declare function markupToMargin(markupPercent: number): number | {
|
|
512
|
+
error: string;
|
|
513
|
+
};
|
|
477
514
|
|
|
478
515
|
type units_AmortizationRow = AmortizationRow;
|
|
479
516
|
type units_AprApyDirection = AprApyDirection;
|
|
@@ -506,6 +543,9 @@ type units_IpConversion = IpConversion;
|
|
|
506
543
|
type units_IsbnFormat = IsbnFormat;
|
|
507
544
|
type units_IsbnResult = IsbnResult;
|
|
508
545
|
type units_LoanResult = LoanResult;
|
|
546
|
+
type units_MarginMarkupField = MarginMarkupField;
|
|
547
|
+
type units_MarginMarkupInput = MarginMarkupInput;
|
|
548
|
+
type units_MarginMarkupResult = MarginMarkupResult;
|
|
509
549
|
type units_NotationStyle = NotationStyle;
|
|
510
550
|
type units_NumberBase = NumberBase;
|
|
511
551
|
type units_PercentChangeDirection = PercentChangeDirection;
|
|
@@ -527,6 +567,7 @@ declare const units_calcAspectRatio: typeof calcAspectRatio;
|
|
|
527
567
|
declare const units_calcSubnet: typeof calcSubnet;
|
|
528
568
|
declare const units_calculateCompoundInterest: typeof calculateCompoundInterest;
|
|
529
569
|
declare const units_calculateLoan: typeof calculateLoan;
|
|
570
|
+
declare const units_calculateMarginMarkup: typeof calculateMarginMarkup;
|
|
530
571
|
declare const units_calculatePercentageChange: typeof calculatePercentageChange;
|
|
531
572
|
declare const units_calculateSimpleInterest: typeof calculateSimpleInterest;
|
|
532
573
|
declare const units_calculateTax: typeof calculateTax;
|
|
@@ -559,6 +600,8 @@ declare const units_isValid: typeof isValid;
|
|
|
559
600
|
declare const units_isValidCidr: typeof isValidCidr;
|
|
560
601
|
declare const units_isValidIp: typeof isValidIp;
|
|
561
602
|
declare const units_isValidIpv4: typeof isValidIpv4;
|
|
603
|
+
declare const units_marginToMarkup: typeof marginToMarkup;
|
|
604
|
+
declare const units_markupToMargin: typeof markupToMargin;
|
|
562
605
|
declare const units_octalToPermissions: typeof octalToPermissions;
|
|
563
606
|
declare const units_parseFileSize: typeof parseFileSize;
|
|
564
607
|
declare const units_parseInput: typeof parseInput;
|
|
@@ -583,7 +626,7 @@ declare const units_validateIban: typeof validateIban;
|
|
|
583
626
|
declare const units_validateIsbn: typeof validateIsbn;
|
|
584
627
|
declare const units_viewportToPx: typeof viewportToPx;
|
|
585
628
|
declare namespace units {
|
|
586
|
-
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateLoan as calculateLoan, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
629
|
+
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_MarginMarkupField as MarginMarkupField, type units_MarginMarkupInput as MarginMarkupInput, type units_MarginMarkupResult as MarginMarkupResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateLoan as calculateLoan, units_calculateMarginMarkup as calculateMarginMarkup, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_marginToMarkup as marginToMarkup, units_markupToMargin as markupToMargin, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
587
630
|
}
|
|
588
631
|
|
|
589
|
-
export {
|
|
632
|
+
export { calcSubnet as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, type MarginMarkupResult as E, type FilePermissions as F, type NumberBase as G, type PercentageChangeResult as H, type IbanValidationResult as I, type Permission as J, type PxConvertResult as K, type LoanResult as L, type MarginMarkupField as M, type NotationStyle as N, type SimpleInterestResult as O, type PercentChangeDirection as P, type SubnetInfo as Q, type TaxResult as R, type SemverVersion as S, type TaxDirection as T, type TimeValueDirection as U, type TimeValueResult as V, type TipSplitResult as W, type ViewportConvertResult as X, autoFormat as Y, bumpVersion as Z, calcAspectRatio as _, type AprApyDirection as a, calculateCompoundInterest as a0, calculateLoan as a1, calculateMarginMarkup as a2, calculatePercentageChange as a3, calculateSimpleInterest as a4, calculateTax as a5, calculateTimeValue as a6, calculateTipSplit as a7, compareSemver as a8, convert as a9, markupToMargin as aA, octalToPermissions as aB, parseFileSize as aC, parseInput as aD, parseNumberString as aE, parseSemver as aF, permissionsToChmod as aG, permissionsToOctal as aH, permissionsToSymbolic as aI, ptToPx as aJ, pxToAll as aK, pxToViewport as aL, remToPx as aM, satisfiesRange as aN, scaleByHeight as aO, scaleByWidth as aP, sortVersions as aQ, splitSubnet as aR, symbolicToPermissions as aS, validateBarcode as aT, validateCardNumber as aU, validateIban as aV, validateIsbn as aW, viewportToPx as aX, convertAprApy as aa, convertBytes as ab, convertIp as ac, coverBox as ad, decimalToIp as ae, decimalToIpCidr as af, describePermissions as ag, fitIntoBox as ah, formatNumber as ai, formatValue as aj, formatVwValue as ak, formatWithSeparator as al, gcd as am, ipFromBinary as an, ipFromDecimal as ao, ipFromHex as ap, ipToBinary as aq, ipToDecimal as ar, ipToDecimalCidr as as, ipToHex as at, ipToOctal as au, isValid as av, isValidCidr as aw, isValidIp as ax, isValidIpv4 as ay, marginToMarkup as az, type AprApyResult as b, type AspectRatioResult as c, BASE_PREFIXES as d, BYTE_UNITS as e, type BarcodeFormat as f, type BarcodeValidationResult as g, type BaseConvertResult as h, type ByteConvertResult as i, type ByteUnit as j, COMMON_LOCALES as k, COMMON_PERMISSIONS as l, COMMON_RATIOS as m, COMMON_SIZES as n, COMMON_TAX_RATES as o, COMMON_TIP_PERCENTAGES as p, COMMON_VIEWPORTS as q, type CardValidationResult as r, type CompoundInterestResult as s, type CompoundYearRow as t, units as u, type FormatOptions as v, type IpConversion as w, type IsbnFormat as x, type IsbnResult as y, type MarginMarkupInput as z };
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* - present-value-calculator : calculateTimeValue
|
|
25
25
|
* - percentage-change-calculator : calculatePercentageChange
|
|
26
26
|
* - apr-apy-converter : convertAprApy
|
|
27
|
+
* - margin-markup-calculator : calculateMarginMarkup, marginToMarkup, markupToMargin
|
|
27
28
|
*/
|
|
28
29
|
interface PxConvertResult {
|
|
29
30
|
px: number;
|
|
@@ -474,6 +475,42 @@ interface AprApyResult {
|
|
|
474
475
|
declare function convertAprApy(rate: number, compoundsPerYear: number, direction: AprApyDirection): AprApyResult | {
|
|
475
476
|
error: string;
|
|
476
477
|
};
|
|
478
|
+
type MarginMarkupField = "cost" | "price" | "marginPercent" | "markupPercent";
|
|
479
|
+
interface MarginMarkupInput {
|
|
480
|
+
cost?: number | null;
|
|
481
|
+
price?: number | null;
|
|
482
|
+
marginPercent?: number | null;
|
|
483
|
+
markupPercent?: number | null;
|
|
484
|
+
}
|
|
485
|
+
interface MarginMarkupResult {
|
|
486
|
+
cost: number;
|
|
487
|
+
price: number;
|
|
488
|
+
profit: number;
|
|
489
|
+
marginPercent: number;
|
|
490
|
+
markupPercent: number;
|
|
491
|
+
given: MarginMarkupField[];
|
|
492
|
+
solvedFor: MarginMarkupField[];
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Solve a pricing triangle: given exactly two of cost, price, gross margin
|
|
496
|
+
* percent, and markup percent, derive the other two. Margin is profit as a
|
|
497
|
+
* share of the selling price (profit / price) while markup is profit as a
|
|
498
|
+
* share of the cost (profit / cost), so a 20% margin is the same deal as a
|
|
499
|
+
* 25% markup — conflating them is the classic mistake this exists to avoid.
|
|
500
|
+
* Margin plus markup alone cannot be solved, since neither carries an
|
|
501
|
+
* absolute amount. Pure closed-form arithmetic, no live price feed.
|
|
502
|
+
*/
|
|
503
|
+
declare function calculateMarginMarkup(input: MarginMarkupInput): MarginMarkupResult | {
|
|
504
|
+
error: string;
|
|
505
|
+
};
|
|
506
|
+
/** Markup percent that produces a given gross margin percent (margin < 100). */
|
|
507
|
+
declare function marginToMarkup(marginPercent: number): number | {
|
|
508
|
+
error: string;
|
|
509
|
+
};
|
|
510
|
+
/** Gross margin percent that results from a given markup percent (markup > -100). */
|
|
511
|
+
declare function markupToMargin(markupPercent: number): number | {
|
|
512
|
+
error: string;
|
|
513
|
+
};
|
|
477
514
|
|
|
478
515
|
type units_AmortizationRow = AmortizationRow;
|
|
479
516
|
type units_AprApyDirection = AprApyDirection;
|
|
@@ -506,6 +543,9 @@ type units_IpConversion = IpConversion;
|
|
|
506
543
|
type units_IsbnFormat = IsbnFormat;
|
|
507
544
|
type units_IsbnResult = IsbnResult;
|
|
508
545
|
type units_LoanResult = LoanResult;
|
|
546
|
+
type units_MarginMarkupField = MarginMarkupField;
|
|
547
|
+
type units_MarginMarkupInput = MarginMarkupInput;
|
|
548
|
+
type units_MarginMarkupResult = MarginMarkupResult;
|
|
509
549
|
type units_NotationStyle = NotationStyle;
|
|
510
550
|
type units_NumberBase = NumberBase;
|
|
511
551
|
type units_PercentChangeDirection = PercentChangeDirection;
|
|
@@ -527,6 +567,7 @@ declare const units_calcAspectRatio: typeof calcAspectRatio;
|
|
|
527
567
|
declare const units_calcSubnet: typeof calcSubnet;
|
|
528
568
|
declare const units_calculateCompoundInterest: typeof calculateCompoundInterest;
|
|
529
569
|
declare const units_calculateLoan: typeof calculateLoan;
|
|
570
|
+
declare const units_calculateMarginMarkup: typeof calculateMarginMarkup;
|
|
530
571
|
declare const units_calculatePercentageChange: typeof calculatePercentageChange;
|
|
531
572
|
declare const units_calculateSimpleInterest: typeof calculateSimpleInterest;
|
|
532
573
|
declare const units_calculateTax: typeof calculateTax;
|
|
@@ -559,6 +600,8 @@ declare const units_isValid: typeof isValid;
|
|
|
559
600
|
declare const units_isValidCidr: typeof isValidCidr;
|
|
560
601
|
declare const units_isValidIp: typeof isValidIp;
|
|
561
602
|
declare const units_isValidIpv4: typeof isValidIpv4;
|
|
603
|
+
declare const units_marginToMarkup: typeof marginToMarkup;
|
|
604
|
+
declare const units_markupToMargin: typeof markupToMargin;
|
|
562
605
|
declare const units_octalToPermissions: typeof octalToPermissions;
|
|
563
606
|
declare const units_parseFileSize: typeof parseFileSize;
|
|
564
607
|
declare const units_parseInput: typeof parseInput;
|
|
@@ -583,7 +626,7 @@ declare const units_validateIban: typeof validateIban;
|
|
|
583
626
|
declare const units_validateIsbn: typeof validateIsbn;
|
|
584
627
|
declare const units_viewportToPx: typeof viewportToPx;
|
|
585
628
|
declare namespace units {
|
|
586
|
-
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateLoan as calculateLoan, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
629
|
+
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_MarginMarkupField as MarginMarkupField, type units_MarginMarkupInput as MarginMarkupInput, type units_MarginMarkupResult as MarginMarkupResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateLoan as calculateLoan, units_calculateMarginMarkup as calculateMarginMarkup, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_marginToMarkup as marginToMarkup, units_markupToMargin as markupToMargin, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
587
630
|
}
|
|
588
631
|
|
|
589
|
-
export {
|
|
632
|
+
export { calcSubnet as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, type MarginMarkupResult as E, type FilePermissions as F, type NumberBase as G, type PercentageChangeResult as H, type IbanValidationResult as I, type Permission as J, type PxConvertResult as K, type LoanResult as L, type MarginMarkupField as M, type NotationStyle as N, type SimpleInterestResult as O, type PercentChangeDirection as P, type SubnetInfo as Q, type TaxResult as R, type SemverVersion as S, type TaxDirection as T, type TimeValueDirection as U, type TimeValueResult as V, type TipSplitResult as W, type ViewportConvertResult as X, autoFormat as Y, bumpVersion as Z, calcAspectRatio as _, type AprApyDirection as a, calculateCompoundInterest as a0, calculateLoan as a1, calculateMarginMarkup as a2, calculatePercentageChange as a3, calculateSimpleInterest as a4, calculateTax as a5, calculateTimeValue as a6, calculateTipSplit as a7, compareSemver as a8, convert as a9, markupToMargin as aA, octalToPermissions as aB, parseFileSize as aC, parseInput as aD, parseNumberString as aE, parseSemver as aF, permissionsToChmod as aG, permissionsToOctal as aH, permissionsToSymbolic as aI, ptToPx as aJ, pxToAll as aK, pxToViewport as aL, remToPx as aM, satisfiesRange as aN, scaleByHeight as aO, scaleByWidth as aP, sortVersions as aQ, splitSubnet as aR, symbolicToPermissions as aS, validateBarcode as aT, validateCardNumber as aU, validateIban as aV, validateIsbn as aW, viewportToPx as aX, convertAprApy as aa, convertBytes as ab, convertIp as ac, coverBox as ad, decimalToIp as ae, decimalToIpCidr as af, describePermissions as ag, fitIntoBox as ah, formatNumber as ai, formatValue as aj, formatVwValue as ak, formatWithSeparator as al, gcd as am, ipFromBinary as an, ipFromDecimal as ao, ipFromHex as ap, ipToBinary as aq, ipToDecimal as ar, ipToDecimalCidr as as, ipToHex as at, ipToOctal as au, isValid as av, isValidCidr as aw, isValidIp as ax, isValidIpv4 as ay, marginToMarkup as az, type AprApyResult as b, type AspectRatioResult as c, BASE_PREFIXES as d, BYTE_UNITS as e, type BarcodeFormat as f, type BarcodeValidationResult as g, type BaseConvertResult as h, type ByteConvertResult as i, type ByteUnit as j, COMMON_LOCALES as k, COMMON_PERMISSIONS as l, COMMON_RATIOS as m, COMMON_SIZES as n, COMMON_TAX_RATES as o, COMMON_TIP_PERCENTAGES as p, COMMON_VIEWPORTS as q, type CardValidationResult as r, type CompoundInterestResult as s, type CompoundYearRow as t, units as u, type FormatOptions as v, type IpConversion as w, type IsbnFormat as x, type IsbnResult as y, type MarginMarkupInput as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|