Last active
November 4, 2015 20:45
-
-
Save courajs/bf8480ae881806edc9d4 to your computer and use it in GitHub Desktop.
app/computed-property-macros/hash.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import hash from 'app/computed-property-macros/hash'; | |
const { | |
Component | |
} = Ember; | |
export default Component.extend({ | |
order: hash('price', 'count') | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { | |
computed, | |
get | |
} = Ember; | |
export default function(...props) { | |
return computed(...props, function(){ | |
let result = {}; | |
props.forEach((prop) => { | |
result[prop] = get(this, prop); | |
}); | |
return result; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment