New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@greenberry/use-label-prefix

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@greenberry/use-label-prefix - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

7

index.js

@@ -21,2 +21,7 @@ "use strict";

var allChars = (0, _ramda.split)('', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789');
var serializeLabel = function serializeLabel(str) {
return str.replace(/\s/gi, '__');
};
var shuffler = (0, _ramda.curry)(function (random, list) {

@@ -50,3 +55,3 @@ var idx = -1;

var _useState = (0, _react.useState)("".concat(prefix, "_").concat(label)),
var _useState = (0, _react.useState)("p_".concat(prefix, "_").concat(serializeLabel(label))),
_useState2 = _slicedToArray(_useState, 1),

@@ -53,0 +58,0 @@ prefixed = _useState2[0];

2

package.json
{
"name": "@greenberry/use-label-prefix",
"version": "0.1.2",
"version": "1.0.0",
"description": "Custom React Hook to prefix labels on Input fields",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,2 +6,8 @@ # `@greenberry/use-label-prefix`

## Why?
When generating a lot of input groups on one page it can get tedious to create a unique label/id for each input group.
However this is required when you want to keep semantics and accessibility functionalities.
This hook generates a prefix for your labels which persist over multiple updates and are unique per instance of the component.
## Installation

@@ -41,2 +47,1 @@

```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc