Skip to content

Commit

Permalink
feat: 🎸 create "units" addon
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jul 11, 2018
1 parent d6f0ad5 commit 0e1e25c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions addon/units.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

exports.addon = function (renderer) {
var list = [
'px',
'cm',
'mm',
'in',
'pt',
'pc',
'em',
'ex',
'ch',
'rem',
'vw',
'vh',
'deg',
'vmin',
'vmax',
];

for (var i = 0; i < list.length; i++) {
var unit = list[i];

renderer[unit] = function (val) {
return val + 'unit';
};
}

renderer.inch = function (val) {
return val + 'in';
};

renderer.pct = function (val) {
return val + '%';
};
};

0 comments on commit 0e1e25c

Please sign in to comment.