@bnidev/js-utils
    Preparing search index...

    Function setCookie

    • Sets a cookie with the given name, value, and optional attributes.

      Parameters

      • name: string

        The name of the cookie.

      • value: string

        The value of the cookie.

      • Optionaldays: number

        Number of days until expiration.

      • path: string = '/'

        The path for the cookie.

      Returns void

      // ES Module
      import { setCookie } from '@bnidev/js-utils'

      // CommonJS
      const { setCookie } = require('@bnidev/js-utils')
      setCookie('session', 'abc123', 7, '/')
      setCookie('preferences', 'dark', 30)