Move ensureArray() in utils.

This commit is contained in:
Julien Fontanet 2015-02-27 17:30:52 +01:00
parent bb31693a4d
commit ed6fcf5ae7
2 changed files with 8 additions and 7 deletions

View File

@ -1,13 +1,7 @@
import forEach from 'lodash.foreach';
import isArray from 'lodash.isarray';
import {$coroutine, $wait} from '../fibers-utils';
import {parseXml} from '../utils';
//====================================================================
function ensureArray(value) {
return isArray(value) ? value : [value];
}
import {ensureArray, parseXml} from '../utils';
//====================================================================

View File

@ -1,6 +1,7 @@
import base64url from 'base64url';
import forEach from 'lodash.foreach';
import has from 'lodash.has';
import isArray from 'lodash.isarray';
import multiKeyHash from 'multikey-hash';
import xml2js from 'xml2js';
import {promisify, method} from 'bluebird';
@ -10,6 +11,12 @@ randomBytes = promisify(randomBytes);
//====================================================================
// Ensure the value is an array, wrap it if necessary.
let ensureArray = (value) => isArray(value) ? value : [value];
export {ensureArray};
//--------------------------------------------------------------------
// Generate a secure random Base64 string.
let generateToken = (n = 32) => randomBytes(n).then(base64url);
export {generateToken};