Skip to content

Commit

Permalink
Remove generateUniqueID helper
Browse files Browse the repository at this point in the history
  • Loading branch information
domoscargin committed Jun 7, 2023
1 parent 51d9328 commit 857bc20
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
20 changes: 0 additions & 20 deletions packages/govuk-frontend/src/govuk/common/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@
* @module common/index
*/

/**
* Used to generate a unique string, allows multiple instances of the component
* without them conflicting with each other.
* https://stackoverflow.com/a/8809472
*
* @deprecated Will be made private in v5.0
* @returns {string} Unique ID
*/
export function generateUniqueID () {
var d = new Date().getTime()
if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
d += window.performance.now() // use high-precision timer if available
}
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0
d = Math.floor(d / 16)
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
})
}

/**
* Config flattening function
*
Expand Down
2 changes: 0 additions & 2 deletions packages/govuk-frontend/src/govuk/common/index.unit.test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { mergeConfigs, extractConfigByNamespace } from './index.mjs'

// TODO: Write unit tests for `generateUniqueID`

describe('Common JS utilities', () => {
describe('mergeConfigs', () => {
const config1 = {
Expand Down

0 comments on commit 857bc20

Please sign in to comment.