Upgrade to Pro — share decks privately, control downloads, hide ads and more …

seamless-immutableのすすめ / Introduction of seamle...

tipo159
October 27, 2017

seamless-immutableのすすめ / Introduction of seamless-immutable

Immutable.js, Moriとの比較
seamless-immutableをすすめる理由
seamless-immutableの概要
ベンチマーク(JavaScript, Immutable.js, Mori, seamless-Immutable)

tipo159

October 27, 2017
Tweet

More Decks by tipo159

Other Decks in Programming

Transcript

  1. Immutable DataϥΠϒϥϦͷछྨ 2 छྨ ໊শ ֓ཁ (JU)VCελʔ਺ ઐ༻σʔλܕ *NNVUBCMFKT -JTU

    4UBDL .BQ 0SEFSFE.BQ  4FU 0SEFSFE4FU 3FDPSEΛఏڙ   .PSJ MJTU WFDUPS IBTI.BQ TFU  TPSUFE4FU SBOHF RVFVFΛఏڙ   طଘσʔλܕ ֦ு TFBNMFTT JNNVUBCMF "SSBZͱ0CKFDUͱޙํޓ׵ੑͷ͋ Δ*NNVUBCMF%BUBΛఏڙ  
  2. seamless-immutableΛ͢͢ΊΔཧ༝ • ίʔυΛେ͖͘มߋͤͣʹImmutable DataΛಋೖՄೳ • Immutable DataΛࢀর͢Δίʔυ͸มߋෆཁ • ྫ͑͹ɼReactΛ࢖ͬͨϓϩδΣΫτʹImmutable.jsΛ్த ͔Βಋೖ͢Δ͜ͱ͸ࠔ೉ʢImmutable.jsͷσʔλܕΛੜ͔͢

    Α͏σʔλߏ଄Λઃܭ͠௚͢ඞཁ͕͋Δʣ • ͜ͷΑ͏ͳέʔεͰ͸ɼߏ଄ͷڞ༗ʹΑΔޮ཰Խ͸Ͱ͖ͳ ͍͕ɼϏϡʔߋ৽ཁ൱൑அͷޮ཰Խ͕Ͱ͖Δseamless- immutableΛ࢖ͬͯΈͯ͸! 3
  3. seamless-immutableͷྫ Immutable([3, 1, 4]).sort() // ImmutableError sort()͕immutableͳϝιουͰ͸ͳ͍ͨΊ Immutable([1, 2, 3]).concat([10,

    9 , 8]).sort() // ImmutableError concat()͕immutableͳϝιουͰ͸ͳ͍ͨΊ [1, 2, 3].concat(Immutable([6, 5, 4])).sort() // [1, 2, 3, 4, 5, 6] // concat()͕mutableͳArrayΛฦͨ͢Ί var obj = Immutable({all: “your base”, are: {belong: “to them”}}); Immutable.merge(obj, {are: {belong: “to us”}}) // Immutable({all: “your base”, are: {belong: “to us”}}) 4
  4. Immutable Object • ҎԼͷϝιουΛ௥Ճ • merge • replace • set

    • setIn • getIn • update • updateIn • without • asMutable 7
  5. ϕϯνϚʔΫ݁Ռ(Array get) 9 ࣮ߦ࣌ؒ NT     

    ܁Γฦ͠ճ਺         +4 *NNVUBCMFKT .PSJ TFBNMFTTJNNVUBCMF
  6. ϕϯνϚʔΫ݁Ռ(Object get) 10 ࣮ߦ࣌ؒ NT     

    ܁Γฦ͠ճ਺         +4 *NNVUBCMFKT .PSJ TFBNMFTTJNNVUBCMF
  7. ϕϯνϚʔΫ݁Ռ(Array set) 11 ࣮ߦ࣌ؒ NT     

    ܁Γฦ͠ճ਺         +4 *NNVUBCMFKT .PSJ TFBNMFTTJNNVUBCMF
  8. ϕϯνϚʔΫ݁Ռ(Object set) 12 ࣮ߦ࣌ؒ NT     

    ܁Γฦ͠ճ਺         +4 *NNVUBCMFKT .PSJ TFBNMFTTJNNVUBCMF