• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rsuite / schema-typed / 8657282119

12 Apr 2024 05:09AM UTC coverage: 95.227%. Remained the same
8657282119

Pull #80

github

web-flow
Merge 1ad0891ec into 9b4a8f368
Pull Request #80: refactor: replace `lodash.set` with `set-value`

332 of 369 branches covered (89.97%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

466 of 469 relevant lines covered (99.36%)

198.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/src/utils/formatErrorMessage.ts
1
import isEmpty from './isEmpty';
3✔
2

3
export function joinName(name: string | string[]) {
3✔
4
  return Array.isArray(name) ? name.join('.') : name;
351✔
5
}
6

7
/**
8
 * formatErrorMessage('${name} is a required field', {name: 'email'});
9
 * output: 'email is a required field'
10
 */
11
export default function formatErrorMessage<E>(errorMessage?: string | E, params?: any) {
3✔
12
  if (typeof errorMessage === 'string') {
978✔
13
    return errorMessage.replace(/\$\{\s*(\w+)\s*\}/g, (_, key) => {
975✔
14
      return isEmpty(params?.[key]) ? `$\{${key}\}` : params?.[key];
942!
15
    });
16
  }
17

18
  return errorMessage;
3✔
19
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc