-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1405d54
commit 81bdcbd
Showing
8 changed files
with
2,548 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const compile = (html, data) => { | ||
for (const key in data) { | ||
html = html.replace(`{{${key}}}`, data[key]); | ||
exports.__esModule = true; | ||
var compile = function (html, data) { | ||
for (var key in data) { | ||
html = html.replace("{{".concat(key, "}}"), data[key]); | ||
} | ||
return html; | ||
}; | ||
exports.default = compile; | ||
exports["default"] = compile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import compile from './index'; | ||
|
||
describe("compile function", () => { | ||
test('inject text thierry in a div', () => { | ||
expect(compile(`<div>{{name}}</div>`, { name: "thierry" })).toBe(`<div>thierry</div>`); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
{ | ||
"name": "mouchetasse", | ||
"version": "1.0.5", | ||
"version": "1.0.8", | ||
"description": "Minimalist templating tool for TypeScript", | ||
"homepage": "https://github.com/NicolasHov/mouchetasse", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "jest" | ||
}, | ||
"author": "Nicolas Hovart <[email protected]>", | ||
"license": "ISC", | ||
"dependencies": { | ||
"jest": "^29.0.1", | ||
"ts-jest": "^28.0.8", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.8.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters