https://github.com/nrkn/maprify
https://github.com/nrkn/maprify
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nrkn/maprify
- Owner: nrkn
- Created: 2013-10-30T04:18:56.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-01T00:46:13.000Z (over 11 years ago)
- Last Synced: 2024-11-06T17:50:33.743Z (6 months ago)
- Language: JavaScript
- Size: 160 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
```javascript
/*
maprify
*/
var interfaces = {
Point: {
x: 'Number',
y: 'Number'
},
Size: {
width: 'Number',
height: 'Number'
},
Rectangle: {
position: 'Point',
size: 'Size'
},
JQueryElement: {
position: 'Function',
width: 'Function',
height: 'Function'
}
};var mappings = {
Rectangle: {
JQueryElement: function( value ){
var position = value.position();
return {
position: {
x: position.left,
y: position.top
},
size: {
width: value.width(),
height: value.height()
}
}
}
}
};var mapper = new Maprify( interfaces, mappings );
var element = $( '.elephant' );
var rectangle = mapper.Rectangle( element );
```