Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 7f89539

Browse files
committed
Fix sprintf with undefined enums format strings
1 parent 50c3bfa commit 7f89539

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/optimizely-sdk/ext/enums.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ const JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk'
44
const NODE_CLIENT_ENGINE = 'node-sdk'
55
const REACT_CLIENT_ENGINE = 'react-sdk'
66

7+
// The normal utils.sprintf accepts the format string as first param.
8+
// That string will be undefined for the strings stubbed by this file (ie,
9+
// ERROR_MESSAGES and LOG_MESSAGES, etc). So we override the sprintf function
10+
// to just splat out the args instead of attempting to invoke .replace on it.
11+
jsSdkUtils.sprintf = (...args) => args.toString()
12+
713
module.exports = {
814
LOG_LEVEL: {
915
NOTSET: 0,

0 commit comments

Comments
 (0)