<commit_before>'use strict';

const httpStatus = require('http-status-codes');

const utils = require('js.shared').utils;

const constants = require('./const');
const db = require('./db');
const rfUtils = require('./rf-utils');
const auth = require('./auth');
const metapublications = require('./metapublications');

exports.checkFigures = checkFigures;
exports.normaliseURL = normaliseURL;
exports.normaliseDOIFigure = normaliseDOIFigure;
exports.normaliseCaption = normaliseCaption;
exports.getFigure = getFigure;
exports.deleteFigure = deleteFigure;
exports.addOrUpdateFigure = addOrUpdateFigure;

function normaliseURL(url) {
    if (rfUtils.checkStringNotEmpty(url)) {
        return url.toLowerCase().substr(0, 255);
    }
    return '';
}

function normaliseCaption(caption) {
    if (rfUtils.checkStringNotEmpty(caption)) {
        return url.toLowerCase().substr(0, 255);<commit_msg>bug fixes in backend<commit_after>'use strict';

const httpStatus = require('http-status-codes');

const utils = require('js.shared').utils;
const vars = require('js.shared').vars;

const constants = require('./const');
const db = require('./db');
const rfUtils = require('./rf-utils');
const auth = require('./auth');
const metapublications = require('./metapublications');

exports.checkFigures = checkFigures;
exports.normaliseURL = normaliseURL;
exports.normaliseDOIFigure = normaliseDOIFigure;
exports.normaliseCaption = normaliseCaption;
exports.getFigure = getFigure;
exports.deleteFigure = deleteFigure;
exports.addOrUpdateFigure = addOrUpdateFigure;

function normaliseURL(url) {
    if (rfUtils.checkStringNotEmpty(url)) {
        return url.toLowerCase().substr(0, 255);
    }
    return '';
}

function normaliseCaption(caption) {
    if (rfUtils.checkStringNotEmpty(caption)) {
        return url.toLowerCase().substr(0, 255);
{'fraction_non_alphanumeric': 0.1387220098306936, 'fraction_numerical': 0.008738394320043691, 'mean_word_length': 5.405594405594406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4576152', 'n_tokens_mistral': 547, 'n_tokens_neox': 533, 'n_words': 109}