aboutsummaryrefslogtreecommitdiffstats
path: root/src/utilities.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities.js')
-rw-r--r--src/utilities.js37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/utilities.js b/src/utilities.js
index e44beac..5ebe808 100644
--- a/src/utilities.js
+++ b/src/utilities.js
@@ -1,41 +1,42 @@
SVG.utils = {
// Map function
- map: function(array, block) {
+ map: function (array, block) {
var i
- , il = array.length
- , result = []
+ var il = array.length
+ var result = []
- for (i = 0; i < il; i++)
+ for (i = 0; i < il; i++) {
result.push(block(array[i]))
+ }
return result
- }
+ },
// Filter function
-, filter: function(array, block) {
+ filter: function (array, block) {
var i
- , il = array.length
- , result = []
+ var il = array.length
+ var result = []
- for (i = 0; i < il; i++)
- if (block(array[i]))
- result.push(array[i])
+ for (i = 0; i < il; i++) {
+ if (block(array[i])) { result.push(array[i]) }
+ }
return result
- }
+ },
// Degrees to radians
-, radians: function(d) {
+ radians: function (d) {
return d % 360 * Math.PI / 180
- }
+ },
// Radians to degrees
-, degrees: function(r) {
+ degrees: function (r) {
return r * 180 / Math.PI % 360
- }
+ },
-, filterSVGElements: function(nodes) {
- return this.filter( nodes, function(el) { return el instanceof window.SVGElement })
+ filterSVGElements: function (nodes) {
+ return this.filter(nodes, function (el) { return el instanceof window.SVGElement })
}
}