Wednesday, October 5, 2016


Destructuring makes code readable

// We could use this directly, but the parameter names won't be obvious
//      EmployeeViewResource.get($state.params)
// So let's do this:
const {employeeId,userId} = $state.params;

EmployeeViewResource.get({employeeId, userId}).$promise.then(result =>

Sunday, October 2, 2016

newing from dynamically-loaded type

newing an object from a dynamically-loaded/reflected type from statically language such as C# and Java requires an API (e.g., Activator.CreateInstance for C# developers). Whereas in node you can still use the new keyword

> new (require('./api/-core/protocol-buffer/proto-mapping')['com.puter.platform.protocols.users.AccountUpdated'])({account: { uuid: {id: '021e4feb-99c4-419b-8891-b38bd6b00897'}}}).encode64();

Don't forget the parenthesis after the new keyword.

Have yet to know what's the difference of the above dynamic object creation from ES6's Reflect.construct.

Happy Coding!