/*
* @lc app=leetcode.cn id=1108 lang=typescript
*
* [1108] IP 地址无效化
*/
// @lc code=start
function defangIPaddr(address: string): string {}
// @lc code=end
function defangIPaddr(address: string): string {
return address.replaceAll('.', '[.]')
}
test.each([
{ input: { address: '1.1.1.1' }, output: '1[.]1[.]1[.]1' },
{ input: { address: '255.100.50.0' }, output: '255[.]100[.]50[.]0' },
])('input: address = $input.address', ({ input: { address }, output }) => {
expect(defangIPaddr(address)).toEqual(output)
})