Skip to content

Be able import mapping utils into a vue component #1113

@dylankelly

Description

@dylankelly

Describe the feature

Exporting the utilities used in mapping functions to prevent duplicating common utils and promote reuse.

Motivation

Ripple Tide content types each have a mapping function - https://ripple.sdp.vic.gov.au/framework/guides/creating-content-types#the-mapping-object. As part of mapping the data from the backend to frontend, we have created a number of utilities that are potentially usable outside of the server mapping context. For example

is duplicated in
export const getAnchorLinkId = (str: string) => {
as it not able to be directly imported. Solving this issue would prevent this duplication.

Proposal

Propose using the folder convention 'helpers' to store utilities that are agnostic of server or backend. These can be imported into a single index.ts file under the ./utils folder for vue context utils or imported into the server mapping as required.

Benefits

prevent duplicating common utils and promote reuse.

Drawbacks

  • More overhead when defining utils

Adoption strategy

Document in https://ripple.sdp.vic.gov.au/framework/guides/creating-content-types and potentially adding unit tests

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be created outside of Ripple-framework as a layer?

Final checks

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions