Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

makeup-next-id

Package Overview
Dependencies
Maintainers
7
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makeup-next-id - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

./dist/cjs/index.js

4

browser.json
{
"dependencies":[
"require: ./dist/index.js"
]
"dependencies": ["require: ./dist/index.js"]
}

@@ -7,5 +7,5 @@ "use strict";

exports.default = _default;
var sequenceMap = {};
var defaultPrefix = 'nid';
var randomPortion = createRandomPortion(3);
const sequenceMap = {};
const defaultPrefix = "nid";
const randomPortion = createRandomPortion(3);
function randomNumber(max) {

@@ -15,11 +15,11 @@ return Math.floor(Math.random() * max);

function createRandomPortion(size) {
var letters = 'abcdefghijklmnopqrstuvwxyz';
var digits = '0123456789';
var allChars = letters + digits;
const letters = "abcdefghijklmnopqrstuvwxyz";
const digits = "0123456789";
const allChars = letters + digits;
// to ensure a valid HTML ID (when prefix is empty), first character must be a letter
var portion = letters[randomNumber(25)];
let portion = letters[randomNumber(25)];
// start iterating from 1, as we already have our first char
for (var i = 1; i < size; i++) {
for (let i = 1; i < size; i++) {
portion += allChars[randomNumber(35)];

@@ -30,7 +30,7 @@ }

function _default(el) {
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;
var separator = prefix === '' ? '' : '-';
let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPrefix;
const separator = prefix === "" ? "" : "-";
// join first prefix with random portion to create key
var key = "".concat(prefix).concat(separator).concat(randomPortion);
const key = "".concat(prefix).concat(separator).concat(randomPortion);

@@ -40,5 +40,5 @@ // initialise key in sequence map if necessary

if (!el.id) {
el.setAttribute('id', "".concat(key, "-").concat(sequenceMap[key]++));
el.setAttribute("id", "".concat(key, "-").concat(sequenceMap[key]++));
}
return el.id;
}
{
"name": "makeup-next-id",
"description": "Assign the next id in sequence to an element, if an id property does not already exist.",
"version": "0.4.1",
"version": "0.4.2",
"main": "./dist/cjs/index.js",

@@ -13,3 +13,3 @@ "module": "./dist/mjs/index.js",

},
"repository": "https://github.com/makeup/makeup-js/tree/master/packages/makeup-next-id",
"repository": "https://github.com/makeup/makeup-js/tree/master/packages/core/makeup-next-id",
"author": "Ian McBurnie <ianmcburnie@hotmail.com>",

@@ -37,3 +37,4 @@ "license": "MIT",

"extends @ebay/browserslist-config"
]
],
"gitHead": "4d199965cba30b5f63cfc38b5b58544cfc5b27c1"
}

@@ -15,6 +15,6 @@ # makeup-next-id

// import the module
import nextId from 'makeup-next-id';
import nextId from "makeup-next-id";
// get NodeList
const widgetEls = document.querySelectorAll('.widget');
const widgetEls = document.querySelectorAll(".widget");

@@ -41,12 +41,12 @@ // assign next id to each element

## Custom Events
## Custom Events
* None
- None
## Dependencies
* [nanoid](https://www.npmjs.com/package/nanoid)
- [nanoid](https://www.npmjs.com/package/nanoid)
## Polyfills
* None
- None
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