Skip to content

Instantly share code, notes, and snippets.

@PartyLich
Last active August 23, 2019 01:15
Show Gist options
  • Save PartyLich/76c082009325ca9db9041f60ff0c7799 to your computer and use it in GitHub Desktop.
Save PartyLich/76c082009325ca9db9041f60ff0c7799 to your computer and use it in GitHub Desktop.
So far away from me
(function farAway() {
const me = {
about: 'Famous musician, looks like Buddy Holly',
birthday: new Date('June 13, 1970'),
hobbies: ['knitting'],
favoriteFood: 'burnt lamb',
}
let you = {
are: function (attr) {return Object.assign({},this, attr)}
know: function (subject) { this.knows.push(subject); }
knows: [],
want = function (method) {
return (subject) => this[method](subject)
},
};
you = you.are({
age: 18,
sex: 'gril',
location: 'small city',
country: 'Japan',
});
you.heardMe = {
medium:'on the radio',
when: new Date((new Date()).getFullYear() - 1,
new Date().getMonth()),
};
you.want('know')(me.about);
you.want('know')(me.hobbies);
you.want('know')(me.favoriteFood);
you.want('know')(me.birthday);
console.info(you);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment