mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
17 lines
474 B
JavaScript
Executable File
17 lines
474 B
JavaScript
Executable File
'use strict';
|
|
|
|
const Assert = require('./assert');
|
|
|
|
|
|
const internals = {};
|
|
|
|
|
|
module.exports = function (attribute) {
|
|
|
|
// Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, "
|
|
|
|
Assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), 'Bad attribute value (' + attribute + ')');
|
|
|
|
return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash
|
|
};
|