-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Initial changes to support OEP65 #535
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,12 +236,15 @@ const optionsShape = { | |
/** | ||
* | ||
* | ||
* @param {Array} [messagesArray=[]] | ||
* @param {Object} newMessages | ||
* @returns {Object} | ||
* @memberof module:Internationalization | ||
*/ | ||
export function mergeMessages(messagesArray = []) { | ||
return Array.isArray(messagesArray) ? merge({}, ...messagesArray) : {}; | ||
export function mergeMessages(newMessages) { | ||
const msgs = Array.isArray(newMessages) ? merge({}, ...newMessages) : newMessages; | ||
messages = merge(messages, msgs); | ||
|
||
return messages; | ||
} | ||
|
||
/** | ||
|
@@ -262,7 +265,7 @@ export function configure(options) { | |
loggingService = options.loggingService; | ||
// eslint-disable-next-line prefer-destructuring | ||
config = options.config; | ||
messages = Array.isArray(options.messages) ? mergeMessages(options.messages) : options.messages; | ||
messages = Array.isArray(options.messages) ? merge({}, ...options.messages) : options.messages; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @arbrandes - the only use of the mergeMessages function was here (and in the unit tests). Note how it has now been changed to use lodash.merge directly. The exports from |
||
|
||
if (config.ENVIRONMENT !== 'production') { | ||
Object.keys(messages).forEach((key) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this would change the expected behavior of the function. Do we know if any other packages/MFEs use it?
Maybe it's best to create a new function for this purpose, just in case. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment below