mikel 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +0 -13
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -35,18 +35,6 @@ const parse = (v, context = {}, vars = {}) => {
|
|
|
35
35
|
return (v || "").startsWith("@") ? get(vars, v.slice(1)) : get(context, v || ".");
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
// @description tiny front-matter parser
|
|
39
|
-
const frontmatter = (str = "", parser = null) => {
|
|
40
|
-
let body = (str || "").trim(), data = {};
|
|
41
|
-
const matches = Array.from(body.matchAll(/^(--- *)/gm))
|
|
42
|
-
if (matches?.length === 2 && matches[0].index === 0) {
|
|
43
|
-
const front = body.substring(0 + matches[0][1].length, matches[1].index).trim();
|
|
44
|
-
body = body.substring(matches[1].index + matches[1][1].length).trim();
|
|
45
|
-
data = typeof parser === "function" ? parser(front) : front;
|
|
46
|
-
}
|
|
47
|
-
return {body, data};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
38
|
// @description default helpers
|
|
51
39
|
const defaultHelpers = {
|
|
52
40
|
"each": p => {
|
|
@@ -187,6 +175,5 @@ mikel.create = create;
|
|
|
187
175
|
mikel.escape = escape;
|
|
188
176
|
mikel.get = get;
|
|
189
177
|
mikel.parse = parse;
|
|
190
|
-
mikel.frontmatter = frontmatter;
|
|
191
178
|
|
|
192
179
|
export default mikel;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mikel",
|
|
3
3
|
"description": "Micro templating library with zero dependencies",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Josemi Juanes",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"./package.json": "./package.json"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
+
"release": "node ./scripts/release.js",
|
|
21
22
|
"test": "node test.js"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|