Skip to content

Commit a245c0a

Browse files
committed
πŸ“¦ v2.2.4
New: - ✨ `{{log variable console=true}}` conditionally log to JS-console from Blaze-template using `console=true` argument Other changes: - 🀝 Compatibility with `meteor@3` - 🀝 Compatibility with `blaze@3` - πŸ“” Minor docs update; Added note for `console=true` argument in `log` helper - πŸ‘¨β€πŸ’» Minor codebase linting
1 parent 911e098 commit a245c0a

File tree

4 files changed

+79
-71
lines changed

4 files changed

+79
-71
lines changed

β€Ž.versions

Lines changed: 68 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22-
23-
24-
25-
26-
27-
28-
29-
30-
31-
32-
local-test:ostrio:[email protected]
33-
34-
35-
36-
37-
38-
39-
40-
41-
42-
43-
44-
45-
46-
47-
48-
49-
50-
51-
52-
53-
54-
55-
56-
57-
58-
59-
60-
61-
62-
63-
64-
65-
1+
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
local-test:ostrio:[email protected]
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+

β€Žpackage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Package.describe({
22
name: 'ostrio:templatehelpers',
3-
version: '2.2.3',
3+
version: '2.2.4',
44
summary: 'Template helpers for logical operations, variable comparison, Session, underscore and debugging',
55
git: 'https://github.com/VeliovGroup/Meteor-Template-helpers',
66
documentation: 'README.md'
77
});
88

99
Package.onUse((api) => {
10-
api.versionsFrom('1.4');
10+
api.versionsFrom(['1.4', '2.0.1', '3.0.1']);
1111
api.use(['templating', 'ecmascript'], 'client');
1212
api.use(['session', 'underscore'], 'client', {weak: true});
1313
api.mainModule('templatehelpers.js', 'client');

β€Žtemplatehelpers-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meteor } from 'meteor/meteor';
1+
import { Meteor } from 'meteor/meteor';
22
import { templatehelpers } from './templatehelpers.js';
33

44
if (Meteor.isServer) {

β€Žtemplatehelpers.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ let _ = false;
77

88
try {
99
Session = require('meteor/session').Session;
10-
} catch (e) {
10+
} catch (_e) {
1111
// session package is not installed
1212
}
1313

1414
try {
1515
_ = require('meteor/underscore')._;
16-
} catch (e) {
16+
} catch (_e) {
1717
// underscore package is not installed
1818
}
1919

@@ -71,9 +71,14 @@ class TemplateHelpers {
7171

7272
log(...args) {
7373
const key = args.shift();
74+
if (typeof args[args.length - 1] === 'object' && args[args.length - 1]?.hash?.console === true) {
75+
delete args[args.length - 1].hash.console;
76+
console.debug('[ostrio:templatehelpers] [LOG]', key, ...args);
77+
}
78+
7479
try {
7580
return `${JSON.stringify(key, null, 2)} | ${JSON.stringify(args, null, 2)}`;
76-
} catch (e) {
81+
} catch (_e) {
7782
return `${key} | ${args}`;
7883
}
7984
}

0 commit comments

Comments
Β (0)