Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions composable.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@
document: function () {
return root.document;
},
location: function () {
return root.location;
},

// Window location transformations
href: function () {
return root.location.href;
},
pathname: function () {
return root.location.pathname;
},

// DOM node transformations
querySelectorAll: function (selector) {
Expand All @@ -96,6 +107,9 @@
innerHTML: function (node) {
return node ? node.innerHTML : null;
},
outerHTML: function (node) {
return node ? node.outerHTML : null;
},
innerText: function (node) {
return node ? node.innerText || node.textContent : null;
},
Expand Down Expand Up @@ -126,6 +140,12 @@
toFloat: function (item) {
return isString(item) || isNumber(item) ? parseFloat(item) : null;
},
toFixed: function (item) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect precision to be the static argument and the number to be the dynamic argument, which I think is the opposite of this change, but maybe I'm misunderstanding the use-case. Are you doing 'toFixed:2' or 'toFixed:12.345'?

var float = isString(item) ? parseFloat(item) : item;
return function (precision) {
return isNumber(float) ? float.toFixed(precision) : null;
};
},
round: function (item) {
return isNumber(item) ? Math.round(item) : null;
},
Expand Down
2 changes: 1 addition & 1 deletion composable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading