🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@bento/to-attribute-value

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bento/to-attribute-value

Format a value as an HTML attribute value.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
3
Created
Source

Attribute Value

The @bento/to-attribute-value package is a formatter that converts any given value into a string that can be used as an HTML attribute value.

Installation

npm install --save @bento/to-attribute-value

stringify

The package exposes the stringify function as the default export. The sole purpose of this function is to format any given value into a string that closely resembles the value as if it was formatted as an HTML attribute value.

The function accepts the following arguments:

import { stringify } from '@bento/to-attribute-value';

console.log(stringify({ hello: 'world'}));        // hello(world)

We automatically format the data based on the type of the value given:

Any unknown object is converted using JSON.stringify. In order for these custom objects to be converted, they must have a toJSON method that returns a serializable object.

The value false is automatically converted to undefined to signal React that the resulting attribute should not end up in the DOM.

Keywords

attribute

FAQs

Package last updated on 06 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts