Skip to content

Instantly share code, notes, and snippets.

@Offirmo
Last active March 28, 2018 14:12
Show Gist options
  • Save Offirmo/00174e72f4e02751ef06495f40ca1d7a to your computer and use it in GitHub Desktop.
Save Offirmo/00174e72f4e02751ef06495f40ca1d7a to your computer and use it in GitHub Desktop.
[rare ES6 stuff I forget all the time] #JavaScript
// imports
import { Random, Engine } from '@offirmo/random'
import {
State as MetaState,
factory as meta_state_factory,
} from '@oh-my-rpg/state-meta'
// http://www.benmvp.com/learning-es6-enhanced-object-literals/
return {
// computed values
['make' + make]: true,
// Method definition shorthand syntax
depreciate() {
this.value -= 2500;
}
};
// Advanced destructuring
// http://wesbos.com/destructuring-default-values/
const person = { first: 'Wes', last: 'Bos' };
const { first: firstName = 'Super Rad' } = person;
console.log(firstName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment