utils: isArray(), isBoolean(), isFunction() & isString().

This commit is contained in:
Julien Fontanet
2016-03-02 11:02:42 +01:00
parent 024a9b1763
commit 5823057b41
13 changed files with 30 additions and 22 deletions

View File

@@ -2,7 +2,6 @@ import createDebug from 'debug'
const debug = createDebug('xo:api')
import getKeys from 'lodash.keys'
import isFunction from 'lodash.isfunction'
import kindOf from 'kindof'
import ms from 'ms'
import schemaInspector from 'schema-inspector'
@@ -16,6 +15,7 @@ import {
import {
createRawObject,
forEach,
isFunction,
noop
} from './utils'

View File

@@ -1,9 +1,11 @@
import isArray from 'lodash.isarray'
import isObject from 'lodash.isobject'
import Model from './model'
import {BaseError} from 'make-error'
import {EventEmitter} from 'events'
import {map} from './utils'
import {
isArray,
isObject,
map
} from './utils'
// ===================================================================

View File

@@ -1,9 +1,9 @@
import bind from 'lodash.bind'
import isArray from 'lodash.isarray'
import isFunction from 'lodash.isfunction'
import {
isArray,
isPromise,
isFunction,
noop,
pFinally
} from './utils'

View File

@@ -1,12 +1,15 @@
import assign from 'lodash.assign'
import getStream from 'get-stream'
import isString from 'lodash.isstring'
import startsWith from 'lodash.startswith'
import { parse as parseUrl } from 'url'
import { request as httpRequest } from 'http'
import { request as httpsRequest } from 'https'
import { stringify as formatQueryString } from 'querystring'
import {
isString
} from './utils'
// -------------------------------------------------------------------
export default (...args) => {

View File

@@ -9,8 +9,6 @@ import eventToPromise from 'event-to-promise'
import has from 'lodash.has'
import helmet from 'helmet'
import includes from 'lodash.includes'
import isArray from 'lodash.isarray'
import isFunction from 'lodash.isfunction'
import pick from 'lodash.pick'
import proxyConsole from './proxy-console'
import proxyRequest from 'proxy-http-request'
@@ -43,6 +41,8 @@ import {
import {
createRawObject,
forEach,
isArray,
isFunction,
mapToArray,
pFromCallback
} from './utils'

View File

@@ -1,9 +1,9 @@
import isString from 'lodash.isstring'
import {EventEmitter} from 'events'
import {
forEach,
isEmpty
isEmpty,
isString
} from './utils'
// ===================================================================

View File

@@ -359,7 +359,11 @@ export const safeDateFormat = d3TimeFormat('%Y%m%dT%H%M%SZ')
//
// Exports them from here to avoid direct dependencies on lodash.
export { default as forEach } from 'lodash.foreach'
export { default as isArray } from 'lodash.isarray'
export { default as isBoolean } from 'lodash.isboolean'
export { default as isEmpty } from 'lodash.isempty'
export { default as isFunction } from 'lodash.isfunction'
export { default as isString } from 'lodash.isstring'
export { default as mapToArray } from 'lodash.map'
// -------------------------------------------------------------------

View File

@@ -1,9 +1,8 @@
import isArray from 'lodash.isarray'
import {
ensureArray,
extractProperty,
forEach,
isArray,
mapToArray,
parseXml
} from './utils'

View File

@@ -3,12 +3,8 @@ import every from 'lodash.every'
import fatfs from 'fatfs'
import fatfsBuffer, { init as fatfsBufferInit } from './fatfs-buffer'
import find from 'lodash.find'
import isBoolean from 'lodash.isboolean'
import includes from 'lodash.includes'
// import isFinite from 'lodash.isfinite'
import isFunction from 'lodash.isfunction'
import isInteger from 'lodash.isinteger'
import isObject from 'lodash.isobject'
import pickBy from 'lodash.pickby'
import sortBy from 'lodash.sortby'
import unzip from 'julien-f-unzip'
@@ -33,6 +29,10 @@ import {
createRawObject,
ensureArray,
forEach,
isBoolean,
isFunction,
isInteger,
isObject,
map,
mapToArray,
noop,

View File

@@ -1,5 +1,4 @@
import createJsonSchemaValidator from 'is-my-json-valid'
import isFunction from 'lodash.isfunction'
import { PluginsMetadata } from '../models/plugin-metadata'
import {
@@ -8,6 +7,7 @@ import {
} from '../api-errors'
import {
createRawObject,
isFunction,
mapToArray
} from '../utils'

View File

@@ -1,5 +1,4 @@
import every from 'lodash.every'
import isObject from 'lodash.isobject'
import remove from 'lodash.remove'
import some from 'lodash.some'
@@ -10,6 +9,7 @@ import {
import {
forEach,
generateUnsecureToken,
isObject,
lightSet,
map,
streamToArray

View File

@@ -1,5 +1,4 @@
import endsWith from 'lodash.endswith'
import isFunction from 'lodash.isfunction'
import levelup from 'level-party'
import startsWith from 'lodash.startswith'
import sublevel from 'level-sublevel'
@@ -7,6 +6,7 @@ import { ensureDir } from 'fs-promise'
import {
forEach,
isFunction,
promisify
} from '../utils'

View File

@@ -1,6 +1,4 @@
import includes from 'lodash.includes'
import isFunction from 'lodash.isfunction'
import isString from 'lodash.isstring'
import XoCollection from 'xo-collection'
import XoUniqueIndex from 'xo-collection/unique-index'
import {createClient as createRedisClient} from 'redis'
@@ -17,6 +15,8 @@ import {
forEach,
generateToken,
isEmpty,
isFunction,
isString,
mapToArray,
noop
} from './utils'