❯ ~/robonen/tools
core
  • stdlibapi
  • platformapi
    ❯
    guide
    • Introduction
    • ❯assignStyle
    • ❯createGuardAttrs
    • ❯decodeCookieValue
    • ❯dispatchAnimationEvent
    • ❯encodeCookieName
    • ❯encodeCookieValue
    • ❯findFirstVisible
    • ❯findLastVisible
    • ❯focus
    • ❯focusFirst
    • ❯focusGuard
    • ❯getActiveElement
    • ❯getAnimationName
    • ❯getCookieValue
    • ❯getTabbableCandidates
    • ❯getTabbableEdges
    • ❯getTranslate
    • ❯hideOthers
    • ❯isAnimatable
    • ❯isEventTarget
    • ❯isHidden
    • ❯isInView
    • ❯isIOS
    • ❯isIPad
    • ❯isIPhone
    • ❯isMac
    • ❯isMobileFirefox
    • ❯isSafari
    • ❯isSelectableInput
    • ❯onAnimationSettle
    • ❯parseCookieString
    • ❯pxValue
    • ❯readInputState
    • ❯resetStyle
    • ❯serializeCookie
    • ❯setStyle
    • ❯shouldSuspendUnmount
    • ❯testUserAgentPlatform
    • ❯writeInputState
  • fetchapi
  • encodingapi
  • crdtapi
vue
  • vueapi
  • writekitapi
  • primitivesui
configs
  • eslintguide
  • tsconfigguide
  • tsdownguide
infra
  • renovateguide
@robonen/platform/encodeCookieName
fn

encodeCookieName

v0.0.5tested

Percent-encodes the characters a cookie name cannot contain (cookie names are RFC 2616 tokens). Typical names — letters, digits, -, _, . — pass through unchanged. ( and ) are escaped as %28/%29.

Source Tests

Example

ts
encodeCookieName('user name'); // 'user%20name'

Signature

ts
export function encodeCookieName(name: string): string{ ... }

Parameters

ParameterTypeDefaultDescription
namestring—The raw cookie name

Returns

stringThe encoded cookie name
on this page
  • Example
  • Signature
  • Parameters
  • Returns