Skip to content

Commit

Permalink
Create typeof.js
Browse files Browse the repository at this point in the history
Add implementation of javascript "typeof".
Implementation is based on json.js call which will yield a inline string as a result.

Registration into helpers list is required if approved.
https://github.com/bigcommerce/paper-handlebars/blob/master/helpers.js
  • Loading branch information
34638a authored Feb 7, 2025
1 parent 4fbc7b7 commit 54551f5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions helpers/typeof.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';
const common = require('./lib/common.js');

const factory = globals => {
return function(data) {
data = common.unwrapIfSafeString(globals.handlebars, data);
return typeof data;
};
};

module.exports = [{
name: 'typeof',
factory: factory,
}];

0 comments on commit 54551f5

Please sign in to comment.