Skip to content

mojolicious/util.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

66202b6 Â· Aug 24, 2024

History

59 Commits
Aug 17, 2024
Mar 9, 2023
Nov 24, 2022
Jun 21, 2022
Oct 20, 2023
Aug 24, 2024
Jun 21, 2022
Jun 21, 2022
Mar 9, 2023
Nov 24, 2022
Jun 21, 2022
Feb 8, 2023
Aug 23, 2024
Jun 21, 2022
Jun 21, 2022
Jun 21, 2022

Repository files navigation

Coverage Status npm

Just a bunch of utility functions and classes shared by mojo.js packages.

import {SafeString, escapeRegExp, xmlEscape, xmlUnescape} from '@mojojs/util';

// "te\*s\?t"
const str = escapeRegExp('te*s?t');

// "<p>"
const str = xmlEscape('<p>');

// "<p>"
const str = xmlEscape(new SafeString('<p>'));

// "<p>"
const str = xmlUnescape('&lt;p&gt;&apos;');

Installation

All you need is Node.js 16.0.0 (or newer).

$ npm install @mojojs/util

Support

If you have any questions the documentation might not yet answer, don't hesitate to ask in the Forum, on Matrix, or IRC.