FaasJS
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security

Documents / @faasjs/utils

@faasjs/utils

@faasjs/utils

FaasJS cross-runtime utility helpers.

The package bundles pure utilities that work across Node.js, browsers, and edge runtimes, including deep merge helpers, random identifier helpers, and stream conversion helpers.

Install

npm install @faasjs/utils

Usage

import { deepMerge, streamToString } from '@faasjs/utils'

const merged = deepMerge({ a: 1 }, { b: 2 })
const text = await streamToString(
  new ReadableStream<Uint8Array>({
    start(controller) {
      controller.enqueue(new TextEncoder().encode('hello'))
      controller.close()
    },
  }),
)

console.log(merged, text)

Functions

  • deepMerge
  • generateId
  • isObjectRecord
  • objectToStream
  • parseArrayFromJson
  • parseJson
  • parseObjectFromJson
  • parseYaml
  • streamToObject
  • streamToString
  • stringToStream
  • toErrorMessage

Type Aliases

  • Z

Variables

  • z