Skip to content

Commit

Permalink
Mark common helpers as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
36degrees committed Apr 12, 2023
1 parent c84b53c commit efb9c42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions package/govuk-esm/common/closest-attribute-value.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import '../vendor/polyfills/Element/prototype/closest.mjs'
/**
* Returns the value of the given attribute closest to the given element (including itself)
*
* @deprecated Will be made private in v5.0
* @param {HTMLElement} $element - The element to start walking the DOM tree up
* @param {string} attributeName - The name of the attribute
* @returns {string | undefined} Attribute value
Expand Down
4 changes: 4 additions & 0 deletions package/govuk-esm/common/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* This seems to fail in IE8, requires more investigation.
* See: /~https://github.com/imagitama/nodelist-foreach-polyfill
*
* @deprecated Will be made private in v5.0
* @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
* @param {nodeListIterator} callback - Callback function to run for each node
* @returns {void}
Expand All @@ -31,6 +32,7 @@ export function nodeListForEach (nodes, callback) {
* 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 () {
Expand All @@ -52,6 +54,7 @@ export function generateUniqueID () {
* (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
* greatest priority on the LAST item passed in.
*
* @deprecated Will be made private in v5.0
* @returns {Object<string, unknown>} A flattened object of key-value pairs.
*/
export function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
Expand Down Expand Up @@ -123,6 +126,7 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
* Extracts keys starting with a particular namespace from a flattened config
* object, removing the namespace in the process.
*
* @deprecated Will be made private in v5.0
* @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.
* @param {string} namespace - The namespace to filter keys with.
* @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed
Expand Down
2 changes: 2 additions & 0 deletions package/govuk-esm/common/normalise-dataset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import '../vendor/polyfills/String/prototype/trim.mjs'
* Designed to be used to convert config passed via data attributes (which are
* always strings) into something sensible.
*
* @deprecated Will be made private in v5.0
* @param {string} value - The value to normalise
* @returns {string | boolean | number | undefined} Normalised data
*/
Expand Down Expand Up @@ -46,6 +47,7 @@ export function normaliseString (value) {
*
* Loop over an object and normalise each value using normaliseData function
*
* @deprecated Will be made private in v5.0
* @param {DOMStringMap} dataset - HTML element dataset
* @returns {Object<string, unknown>} Normalised dataset
*/
Expand Down

0 comments on commit efb9c42

Please sign in to comment.