Experimenting with Immutable.js
trying to figure out how this works, how to deal with javascript objects, how to update.
by edwardmsmith
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.7.4/immutable.min.js"></script>
JavaScript
// Playing with a "Record" data type
Target = Immutable.Record({
createdBy: '',
maxWordCount: undefined,
url: '',
assignment: undefined,
submissionDeadline: undefined,
brief: '',
primaryAsset: undefined,
modifiedBy: '',
id: '',
objectType: '',
poindexter: 'fishing'
});
// Here's a Camayak Action object
foo = { target:
{ createdBy: '/v1/users/8f491cfe-3879-4392-80cd-a720a52eb983/',
maxWordCount: null,
url: '/v1/packages/7a85a4ed-1ee2-46de-a342-ca2a3386efad/',
assignment:
{ accessrule: [Object],
url: '/v1/assignments/bd215ab7-cfb9-4c36-8c63-fb3af4ea2714/',
pitch: null,
id: 'bd215ab7-cfb9-4c36-8c63-fb3af4ea2714',
modifiedBy: '/v1/users/8f491cfe-3879-4392-80cd-a720a52eb983/',
createdBy: '/v1/users/8f491cfe-3879-4392-80cd-a720a52eb983/',
desk: [Object],
slug: 'transition test',
objectType: 'assignment' },
submissionDeadline: null,
brief: '',
primaryAsset:
{ url: '/v1/stories/e17c674506ad4dc7b82526128686690e/',
wordCount: 1,
modifiedBy: '/v1/users/36afaf18-5e2c-4001-98fa-83b1fb78ccec/',
createdBy: '/v1/users/36afaf18-5e2c-4001-98fa-83b1fb78ccec/',
id: 'a8b44717-ce2c-4a8d-b017-e1463ae324ee',
objectType: 'story' },
modifiedBy: '/v1/users/8f491cfe-3879-4392-80cd-a720a52eb983/',
id: '7a85a4ed-1ee2-46de-a342-ca2a3386efad',
objectType: 'assignmentpackage' },
generator: { url: 'http://www.camayak.com' },
title: 'Roman Heindorff\'s account on Camayak Blog transition_editing Edward Smith\'s account on Camayak Blog on transition test',
url: '/v1/actions/e59eea56-0b91-4810-9831-c52ce6a2dbe4/',
object:
{ displayName: 'Edward Smith',
createdBy: '/v1/users/8f491cfe-3879-4392-80cd-a720a52eb983/',
url: '/v1/users/8f491cfe-3879-4392-80cd-a720a52eb983/',
lastName: 'Smith',
user: '/users/profiles/22/',
email: '[email protected]',
modifiedBy:...