Restructured src files into a more logical hierarchy

This commit is contained in:
n1474335 2017-03-23 00:33:40 +00:00
parent c9910a8ddb
commit 0f2a5014be
125 changed files with 421 additions and 793 deletions

View file

@ -1,48 +0,0 @@
var Utils = require("../core/Utils.js"),
CryptoJS = require("crypto-js");
/**
* Character encoding operations.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*
* @namespace
*/
var CharEnc = module.exports = {
/**
* @constant
* @default
*/
IO_FORMAT: ["UTF8", "UTF16", "UTF16LE", "UTF16BE", "Latin1", "Windows-1251", "Hex", "Base64"],
/**
* Text encoding operation.
*
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run: function(input, args) {
var inputFormat = args[0],
outputFormat = args[1];
if (inputFormat === "Windows-1251") {
input = Utils.win1251ToUnicode(input);
input = CryptoJS.enc.Utf8.parse(input);
} else {
input = Utils.format[inputFormat].parse(input);
}
if (outputFormat === "Windows-1251") {
input = CryptoJS.enc.Utf8.stringify(input);
return Utils.unicodeToWin1251(input);
} else {
return Utils.format[outputFormat].stringify(input);
}
},
};