UNPKG

rjweb-server

Version:

Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS

80 lines (79 loc) 1.82 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var size_exports = {}; __export(size_exports, { default: () => size }); module.exports = __toCommonJS(size_exports); class Size { /** * Initialize a new Size Class * @since 8.0.0 */ constructor(amount) { this.amount = amount; } /** * Use the provided amount as bytes * @example * ``` * size(10).b() // 10 * ``` * @since 8.0.0 */ b() { return this.amount; } /** * Use the provided amount as kilobytes * @example * ``` * size(10).kb() // 10240 * ``` * @since 8.0.0 */ kb() { return this.amount * 1024; } /** * Use the provided amount as megabytes * @example * ``` * size(10).mb() // 10485760 * ``` * @since 8.0.0 */ mb() { return this.amount * 1024 * 1024; } /** * Use the provided amount as gigabytes * @example * ``` * size(10).gb() // 10737418240 * ``` * @since 8.0.0 */ gb() { return this.amount * 1024 * 1024 * 1024; } } function size(amount) { return new Size(amount); }