@itrocks/template
Advanced tools
Comparing version 0.0.6 to 0.0.7
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Template = exports.frontScripts = void 0; | ||
const rename_1 = require("@itrocks/rename"); | ||
const app_dir_1 = require("@itrocks/app-dir"); | ||
const rename_1 = __importDefault(require("@itrocks/rename")); | ||
const app_dir_1 = __importDefault(require("@itrocks/app-dir")); | ||
const sorted_array_1 = require("@itrocks/sorted-array"); | ||
@@ -778,1 +781,2 @@ const promises_1 = require("node:fs/promises"); | ||
exports.Template = Template; | ||
//# sourceMappingURL=template.js.map |
@@ -13,5 +13,5 @@ { | ||
"devDependencies": { | ||
"@types/jest": "^29.5.14", | ||
"@types/jest": "^29.5", | ||
"@types/node": "^22.9", | ||
"jest": "^29.7.0", | ||
"jest": "^29.7", | ||
"ts-jest": "^29.2", | ||
@@ -28,7 +28,7 @@ "typescript": "~5.6" | ||
"files": [ | ||
"LICENSE", | ||
"README.md", | ||
"cjs", | ||
"template.d.ts", | ||
"template.js" | ||
"/LICENSE", | ||
"/README.md", | ||
"/cjs/*.js", | ||
"/template.d.ts", | ||
"/template.js" | ||
], | ||
@@ -55,3 +55,3 @@ "keywords": [ | ||
"name": "@itrocks/template", | ||
"repository": "https://github.com/itrocks-ts/template", | ||
"repository": { "git": "https://github.com/itrocks-ts/template" }, | ||
"scripts": { | ||
@@ -64,3 +64,3 @@ "build": "npm run build:cjs && npm run build:esm", | ||
"types": "./template.d.ts", | ||
"version": "0.0.6" | ||
"version": "0.0.7" | ||
} |
@@ -21,3 +21,3 @@ [![view on npm](https://badgen.net/npm/v/@itrocks/template)](https://www.npmjs.org/package/@itrocks/template) | ||
console.log( | ||
new Template({ | ||
await new Template({ | ||
users: [ | ||
@@ -72,2 +72,5 @@ { age: 10, name: 'kid' }, | ||
This library is fully compatible with both ECMAScript modules (import) and CommonJS (require), | ||
adapting seamlessly to your project's module system. | ||
## Key features | ||
@@ -198,3 +201,3 @@ | ||
console.log( | ||
new Template({ var: 15 }).parseBuffer('<span>{var}</span>') | ||
await new Template({ var: 15 }).parseBuffer('<span>{var}</span>') | ||
) | ||
@@ -212,3 +215,3 @@ ``` | ||
console.log( | ||
new Template({ var: () => 15 }).parseBuffer('<span>{var}</span>') | ||
await new Template({ var: () => 15 }).parseBuffer('<span>{var}</span>') | ||
) | ||
@@ -225,3 +228,3 @@ ``` | ||
```ts | ||
console.log(new Template(15).parseBuffer('<span>{.}</span>')) | ||
console.log(await new Template(15).parseBuffer('<span>{.}</span>')) | ||
``` | ||
@@ -270,3 +273,3 @@ Result: | ||
console.log( | ||
new Template({ user: { age: 10, name: 'kid' } }) | ||
await new Template({ user: { age: 10, name: 'kid' } }) | ||
.parseBuffer('<span>{user.name} is {user.age} years old</span>') | ||
@@ -278,3 +281,3 @@ ) | ||
console.log( | ||
new Template({ user: { age: 10, name: 'kid' } }) | ||
await new Template({ user: { age: 10, name: 'kid' } }) | ||
.parseBuffer('<span><!--user-->{name} is {age} years old<!--end--></span>') | ||
@@ -293,3 +296,3 @@ ) | ||
console.log( | ||
new Template({ object: { first: 'kid', next: 'old-timer' } }) | ||
await new Template({ object: { first: 'kid', next: 'old-timer' } }) | ||
.parseBuffer('<ul><!--object.*--><li>{.}<!--end--></ul>') | ||
@@ -307,3 +310,3 @@ ) | ||
console.log( | ||
new Template({ users: ['kid', 'old-timer'] }) | ||
await new Template({ users: ['kid', 'old-timer'] }) | ||
.parseBuffer('<ul><!--users--><li>{.}</li><!--end--></ul>') | ||
@@ -321,3 +324,3 @@ ) | ||
console.log( | ||
new Template({ | ||
await new Template({ | ||
users: [ | ||
@@ -350,3 +353,3 @@ { age: 10, name: 'kid' }, | ||
console.log( | ||
new Template({ name: 'Eddie', data: { age: 30, status: 'well' } }) | ||
await new Template({ name: 'Eddie', data: { age: 30, status: 'well' } }) | ||
.parseBuffer(` | ||
@@ -386,3 +389,3 @@ <!--data--> | ||
console.log( | ||
new Template({ name: 'EDITH' }) | ||
await new Template({ name: 'EDITH' }) | ||
.parseBuffer('<span>{name.lcFirst}</span>') | ||
@@ -464,7 +467,7 @@ ) | ||
console.log( | ||
new MyTemplate({ name: 'Nick' }) | ||
.parseBuffer(` | ||
<h2>What is my name</h2> | ||
<p>My name is {name}</p> | ||
`) | ||
await new MyTemplate({ name: 'Nick' }) | ||
.parseBuffer(` | ||
<h2>What is my name</h2> | ||
<p>My name is {name}</p> | ||
`) | ||
) | ||
@@ -482,7 +485,7 @@ ``` | ||
console.log( | ||
new MyTemplate({ name: 'Nick' }) | ||
.parseBuffer(` | ||
<h2>What is my name</h2> | ||
<p>My <span>name</span> is {name}</p> | ||
`) | ||
await new MyTemplate({ name: 'Nick' }) | ||
.parseBuffer(` | ||
<h2>What is my name</h2> | ||
<p>My <span>name</span> is {name}</p> | ||
`) | ||
) | ||
@@ -489,0 +492,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
96789
1634
649