Move ensureArray() in utils.
This commit is contained in:
parent
bb31693a4d
commit
ed6fcf5ae7
@ -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';
|
||||
|
||||
//====================================================================
|
||||
|
||||
|
@ -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};
|
||||
|
Loading…
Reference in New Issue
Block a user