precis-js
Version:
A JavaScript implementation of RFC 7564 (The PRECIS Framework).
47 lines (33 loc) • 1.34 kB
JavaScript
// Generated by CoffeeScript 1.10.0
(function() {
var EmptyStringError, OpaqueStringProfile, precis;
EmptyStringError = require('../error/EmptyStringError');
precis = require('../constants');
module.exports = OpaqueStringProfile = (function() {
function OpaqueStringProfile() {}
OpaqueStringProfile.prototype.stringClass = precis.STRING_CLASS.FREEFORM;
OpaqueStringProfile.prototype.widthMapping = precis.WIDTH_MAPPING.NONE;
OpaqueStringProfile.prototype.caseMapping = precis.CASE_MAPPING.NONE;
OpaqueStringProfile.prototype.normalization = precis.NORMALIZATION.C;
OpaqueStringProfile.prototype.directionality = precis.DIRECTIONALITY.NONE;
OpaqueStringProfile.prototype.map = function(codepoints, enforcer) {
var codepoint, i, j, len, results;
results = [];
for (i = j = 0, len = codepoints.length; j < len; i = ++j) {
codepoint = codepoints[i];
if (enforcer.propertyReader.isNonAsciiSpace(codepoint)) {
results.push(codepoints[i] = 0x20);
} else {
results.push(void 0);
}
}
return results;
};
OpaqueStringProfile.prototype.validate = function(codepoints) {
if (codepoints.length < 1) {
throw new EmptyStringError();
}
};
return OpaqueStringProfile;
})();
}).call(this);