Sha256: 607cd9991bf27a4e731ad18c565697bf8c02cd54a9a371b43bab442a109ad51d

Contents?: true

Size: 762 Bytes

Versions: 7

Compression:

Stored size: 762 Bytes

Contents

const isObject = value => (
  typeof value === 'object' &&
  value !== null &&
  (value.length === undefined || value.length === null)
)

const isEmpty = value => (value === null || value === undefined)

const isString = key => key && typeof key === 'string'

const isStrPath = (key) => {
  if (!isString(key)) throw new Error(`Key ${key} should be string`)
  return isString(key) && key.includes('.')
}

const isArray = value => Array.isArray(value)

const isEqual = (target, source) => JSON.stringify(target) === JSON.stringify(source)

const canMerge = value => isObject(value) || isArray(value)

const prettyPrint = obj => JSON.stringify(obj, null, 2)

module.exports = {
  isObject,
  isArray,
  isEqual,
  isEmpty,
  isStrPath,
  canMerge,
  prettyPrint
}

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
webpacker-jets-3.2.101 package/utils/helpers.js
webpacker-jets-3.2.100 package/utils/helpers.js
webpacker-3.2.2 package/utils/helpers.js
webpacker-3.2.1 package/utils/helpers.js
webpacker-3.2.0 package/utils/helpers.js
webpacker-3.1.1 package/utils/helpers.js
webpacker-3.1.0 package/utils/helpers.js