mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-07 17:41:33 +00:00
Don't export default objects / namespaces
Import individual functions, instead.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
import stream from 'web-stream-tools';
|
||||
import base64 from './base64.js';
|
||||
import * as base64 from './base64.js';
|
||||
import enums from '../enums.js';
|
||||
import config from '../config';
|
||||
import util from '../util';
|
||||
@@ -233,7 +233,7 @@ function splitChecksum(text) {
|
||||
* @async
|
||||
* @static
|
||||
*/
|
||||
function dearmor(input) {
|
||||
export function unarmor(input) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const reSplit = /^-----[^-]+-----$/m;
|
||||
@@ -359,7 +359,7 @@ function dearmor(input) {
|
||||
* @returns {String | ReadableStream<String>} Armored text
|
||||
* @static
|
||||
*/
|
||||
function armor(messagetype, body, partindex, parttotal, customComment) {
|
||||
export function armor(messagetype, body, partindex, parttotal, customComment) {
|
||||
let text;
|
||||
let hash;
|
||||
if (messagetype === enums.armor.signed) {
|
||||
@@ -426,8 +426,3 @@ function armor(messagetype, body, partindex, parttotal, customComment) {
|
||||
|
||||
return util.concat(result);
|
||||
}
|
||||
|
||||
export default {
|
||||
encode: armor,
|
||||
decode: dearmor
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ if (Buffer) {
|
||||
* @returns {String | ReadableStream<String>} radix-64 version of input string
|
||||
* @static
|
||||
*/
|
||||
function encode(data) {
|
||||
export function encode(data) {
|
||||
let buf = new Uint8Array();
|
||||
return stream.transform(data, value => {
|
||||
buf = util.concatUint8Array([buf, value]);
|
||||
@@ -65,7 +65,7 @@ function encode(data) {
|
||||
* @returns {Uint8Array | ReadableStream<Uint8Array>} binary array version of input string
|
||||
* @static
|
||||
*/
|
||||
function decode(data) {
|
||||
export function decode(data) {
|
||||
let buf = '';
|
||||
return stream.transform(data, value => {
|
||||
buf += value;
|
||||
@@ -92,5 +92,3 @@ function decode(data) {
|
||||
return decoded;
|
||||
}, () => decodeChunk(buf));
|
||||
}
|
||||
|
||||
export default { encode, decode };
|
||||
|
||||
Reference in New Issue
Block a user