1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-12-03 10:59:13 -05:00
shimapan/app/util/canonicalize.js

8 lines
289 B
JavaScript

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