Fix some compilation errors.

This commit is contained in:
Julien Fontanet 2015-04-18 19:35:18 +02:00
parent 75ab9d2e8c
commit 580ae005f4
4 changed files with 14 additions and 16 deletions

View File

@ -1,5 +1,5 @@
import debug from 'debug'
debug = debug('xo:api')
import createDebug from 'debug'
const debug = createDebug('xo:api')
import assign from 'lodash.assign'
import Bluebird from 'bluebird'

View File

@ -8,7 +8,7 @@ import {mapInPlace} from './utils'
// ===================================================================
export class ModelAlreadyExists {
export class ModelAlreadyExists extends BaseError {
constructor (id) {
super('this model already exists: ' + id)
}

View File

@ -8,8 +8,6 @@ import xml2js from 'xml2js'
import {promisify, method} from 'bluebird'
import {randomBytes} from 'crypto'
randomBytes = promisify(randomBytes)
/* eslint no-lone-blocks: 0 */
// ===================================================================
@ -26,12 +24,13 @@ export const ensureArray = (value) => {
// -------------------------------------------------------------------
// Generate a secure random Base64 string.
export const generateToken = (n = 32) => randomBytes(n).then(base64url)
export const generateToken = (function (randomBytes) {
return (n = 32) => randomBytes(n).then(base64url)
})(promisify(randomBytes))
// -------------------------------------------------------------------
export let formatXml
{
export const formatXml = (function () {
const builder = new xml2js.Builder({
xmldec: {
// Do not include an XML header.
@ -44,17 +43,16 @@ export let formatXml
}
})
formatXml = (...args) => builder.buildObject(...args)
}
return (...args) => builder.buildObject(...args)
})()
export let parseXml
{
export const parseXml = (function () {
const opts = {
mergeAttrs: true,
explicitArray: false
}
parseXml = (xml) => {
return (xml) => {
let result
// xml2js.parseString() use a callback for synchronous code.
@ -68,7 +66,7 @@ export let parseXml
return result
}
}
})()
// -------------------------------------------------------------------

View File

@ -1,8 +1,8 @@
import assign from 'lodash.assign'
import debug from 'debug'
import createDebug from 'debug'
import WebSocket from 'ws'
debug = debug('xo:wsProxy')
const debug = createDebug('xo:wsProxy')
const defaults = {
// Automatically close the client connection when the remote close.