DefinitelyTyped/types/decomment/decomment-tests.ts
Piotr Błażejewicz (Peter Blazejewicz) 80b5c8a717
feat(decomment): type definition for v0.9 (#42779)
- type definitions
- tests

https://github.com/vitaly-t/decomment#api

Thanks!
2020-03-02 17:47:31 -08:00

12 lines
535 B
TypeScript

import decomment = require('decomment');
const code = '/* comment */\r\n\r\n var test = 123';
decomment(code); // $ExpectType string
decomment(code, { space: true }); // $ExpectType string
decomment(code, { ignore: /\/\*\*\s*\n([^\*]|(\*(?!\/)))*\*\//g }); // $ExpectType string
decomment(code, { trim: true }); // $ExpectType string
const text = '.my-class{color:Red;}// comments';
decomment.text(text); // $ExpectType string
decomment.html(text, { space: true }); // $ExpectType string
decomment.getEOL(text); // $ExpectType string