mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
17 lines
373 B
TypeScript
17 lines
373 B
TypeScript
import * as React from 'react';
|
|
import assertEqualJSX = require('assert-equal-jsx');
|
|
|
|
function sanitizeId(str: string): string {
|
|
return str.replace(/my-component-id-(\d+)/ig, 'my-component-id-0');
|
|
}
|
|
|
|
assertEqualJSX(
|
|
<div id='my-component-id-314159265' />,
|
|
// should equal:
|
|
<div id='my-component-id-0' />,
|
|
// with sanitization:
|
|
{
|
|
sanitize: sanitizeId
|
|
}
|
|
);
|