An assert function that is used to compare multiline string. Support placeholders.
npm install string-looks-likestring-looks-like
==================



An assert utility that is used to assert multiline string. Support placeholders.
!screenshot
Installation
------------
``
`
npm install -D string-looks-like
`
Usage
-----
js
const {looksLike} = require("string-looks-like");
looksLike("Hello world!", "Hello {{\w+}}!");
looksLike(helloWorldFunction.toString(),
function test() {
console.log("hello {{\w+}}!");
}
);
`
looksLike
API
----
This module exports following members:
*
`
$3
js
`
looksLike(actual: String, expect: String) => Array
AssertionError
Test a string with a template and throw an if not matched.
expect
* Whitespace in matches zero or more whitespaces.
{{}}` will be converted into regexp. Matched string or the match object (with capture groups) will be stored in an array as the return value.
* A placeholder
* Compare character-by-character.
Related projects
----------------
* html-looks-like
Changelog
---------
* 0.1.1 (Feb 7, 2020)
- Add: return matched result.
- Fix: multiple placeholders.
* 0.1.0 (Feb 7, 2020)
- First release.