JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q42279F
  • License ISC

A modern collection of reusable utility functions for JavaScript and TypeScript, designed to simplify everyday development tasks.

Package Exports

  • xrg-utils
  • xrg-utils/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xrg-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

xrg-utils

A collection of utility functions for common JavaScript/TypeScript.A modern collection of reusable utility functions for JavaScript and TypeScript, designed to simplify everyday development tasks.

Installation

npm install xrg-utils

Available Utilities

pipeline
import utils from "xrg-utils";

const [op1, op2] = utils.pipeline({
   input: [5, 2, 8, 3, 1, 4],
   filter: (num) => num % 2 === 0,
   map: {
      matched: (num) => num * num,
      unmatched: (num) => -num,
   },
   sort: {
      matched: (a, b) => a - b,
      unmatched: (a, b) => a - b,
   },
});

console.log("op1:", op1); // [4, 16, 64]
console.log("op2:", op2); // [-5, -3, -1]
generatePassword
import utils from "xrg-utils";

utils.generatePassword(12); // Generates a 12-character password
getBase64
import utils from "xrg-utils";

// For files:
const fileBase64 = await utils.getBase64(file);
slug
import utils from "xrg-utils";

const urlSlug = utils.slug("Some String to Slugify"); // "some-string-to-slugify"
truncate
import utils from "xrg-utils";

const shortText = utils.truncate("Very long text here", 10); // "Very long..."\

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to contribute to this project.

License

This package is open-source and available under the MIT License.