UNPKG

my-awesome-npm-package-with-bunjs

Version:
55 lines (52 loc) 1.62 kB
var __defProp = Object.defineProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __hasOwnProp = Object.prototype.hasOwnProperty; var __moduleCache = /* @__PURE__ */ new WeakMap; var __toCommonJS = (from) => { var entry = __moduleCache.get(from), desc; if (entry) return entry; entry = __defProp({}, "__esModule", { value: true }); if (from && typeof from === "object" || typeof from === "function") __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable })); __moduleCache.set(from, entry); return entry; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true, configurable: true, set: (newValue) => all[name] = () => newValue }); }; // src/index.ts var exports_src = {}; __export(exports_src, { stringUtils: () => stringUtils, numberUtils: () => numberUtils }); module.exports = __toCommonJS(exports_src); // src/utils/numbers/numbers.ts var numberUtils = { isEven: (num) => num % 2 === 0, isOdd: (num) => num % 2 !== 0, sum: (nums) => nums.reduce((acc, val) => acc + val, 0) }; // src/utils/strings/strings.ts var stringUtils = { capitalize: (str) => { return str.charAt(0).toUpperCase() + str.slice(1); }, reverse: (str) => { return str.split("").reverse().join(""); }, countWords: (str) => { return str.split(/\s+/).filter(Boolean).length; } };