Refactor src/encoding/*.js and src/hkp/*.js to use import

This commit is contained in:
Tankred Hase 2016-02-05 12:40:30 +07:00
parent 509d6c67ee
commit 8559cd2bff
2 changed files with 5 additions and 6 deletions

View File

@ -24,9 +24,9 @@
'use strict';
var base64 = require('./base64.js'),
enums = require('../enums.js'),
config = require('../config');
import base64 from './base64.js';
import enums from '../enums.js';
import config from '../config';
/**
* Finds out which Ascii Armoring type is used. Throws error if unknown type.

View File

@ -22,9 +22,8 @@
* in order to lookup and upload keys on standard public key servers.
* @module hkp/hkp
*/
module.exports = HKP;
var config = require('../config');
import config from '../config';
/**
* Initialize the HKP client and configure it with the key server url and fetch function.
@ -32,7 +31,7 @@ var config = require('../config');
* @param {String} keyServerBaseUrl (optional) The HKP key server base url including
* the protocol to use e.g. https://pgp.mit.edu
*/
function HKP(keyServerBaseUrl) {
export default function HKP(keyServerBaseUrl) {
this._baseUrl = keyServerBaseUrl ? keyServerBaseUrl : config.keyserver;
this._fetch = typeof window !== 'undefined' ? window.fetch : require('node-fetch');
}