How to use the @serverless/utils.concat function in @serverless/utils

To help you get started, we’ve selected a few @serverless/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
const concatInputsAndState = (inputs, state = []) => {
  const attributeKeys = map((item) => head(keys(item)), inputs)
  return filter((item) => isNil(find(equals(item))(state)))(
    concat(
      inputs,
      reduce(
        (attributes, attribute) => {
          const key = head(keys(attribute))
          if (!contains(key, attributeKeys)) {
            // return empty string to "unset" removed value
            return concat(attributes, [{ [key]: '' }])
          }
          return attributes
        },
        [],
        state
      )
    )
  )
}
github serverless / components / registry / AwsSnsSubscription / src / index.js View on Github external
(attributes, key) => {
        if (!contains(key, keys(inputs))) {
          // return empty object to "unset" removed value
          return concat(attributes, [{ [key]: {} }])
        }
        return attributes
      },
      [],
github serverless / components / src / utils / variable / evaluateVariableString.js View on Github external
const evaluateVariableString = (variableString, data) => {
  const { exact, match, expression } = matchVariable(variableString)

  if (!match) {
    return variableString
  }

  const resolvedExpression = evaluateVariableString(expression, data)

  const self = get('this', data)
  data = omit(['this'], data)

  const params = concat(keys(data), UTIL_METHODS.KEYS)
  const args = concat(values(data), UTIL_METHODS.VALUES)
  const func = new Function(params, `return ${resolvedExpression}`)

  let value = func.apply(self, args)
  if (!exact) {
    value = variableString.replace(match, value)
  }
  return value
}
github serverless / components / src / utils / component / getParentIds.js View on Github external
const getParentIds = (component) => {
  const parent = get('parent', component)
  if (parent) {
    return concat([get('instanceId', parent)], getParentIds(parent))
  }
  return []
}
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
(result, attribute) =>
      concat(result, map((key) => ({ [key]: attribute[key] }), keys(attribute))),
    [],
github serverless / components / src / utils / component / walkReduceEvaluables.js View on Github external
forEach((childValue, childKdx) => {
          if (!isComponent(childValue)) {
            const newKeys = concat(keys, [childKdx])
            result = recur(result, childValue, newKeys, iteratee)
          }
        }, value)
      }
github serverless / components / src / utils / component / walkReduceComponentReferences.js View on Github external
forEach((childValue, childKdx) => {
          const newKeys = concat(keys, [childKdx])
          if (isComponent(childValue)) {
            visited.add(childValue)
            result = iteratee(result, childValue, newKeys)
          } else {
            result = recur(result, childValue, newKeys, iteratee)
          }
        }, value)
      }
github serverless / components / src / utils / component / getDependenciesIds.js View on Github external
const getDependenciesIds = (component) =>
  without(
    union(getParentIds(component), [component.instanceId]),
    union(
      concat(getChildrenIds(component), getVariableInstanceIds(component)),
      getComponentReferenceIds(component)
    )
  )
github serverless / components / src / utils / component / walkReduceComponentChildren.js View on Github external
forEach((child, childKdx) => {
      const newKeys = concat(keys, [childKdx])
      result = recur(result, resolve(child), newKeys, iteratee)
    }, children)
  }