@azizbecha/strkit
Version:
strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.
26 lines • 926 B
JavaScript
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = toDegrees;
/**
* Converts radians to degrees.
* @param radians - The value in radians to be converted. Can be a number or a string.
* @returns The value in degrees.
* @example
* toDegrees(Math.PI); // 180
* toDegrees('1.5708'); // 90
*/
function toDegrees(radians) {
const rad = typeof radians === 'string' ? parseFloat(radians) : radians;
return rad * (180 / Math.PI);
}
});
//# sourceMappingURL=toDegrees.js.map