1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-30 22:41:47 -05:00
shimapan/app/util/canonicalize.js

8 lines
326 B
JavaScript

// Normalizes, decomposes, and lowercases a utf-8 string
exports.canonicalize = displayname => displayname.normalize('NFKD').toLowerCase();
exports.canonicalizeRequest =
(req, res, next) => {
req.body.username = req.body.displayname ? exports.canonicalize(req.body.displayname) : undefined;
next();
};