Giter Club home page Giter Club logo

Comments (8)

azu avatar azu commented on July 1, 2024

ES2023 introduces new array copying methods to JavaScript | Sonar

from js-primer.

azu avatar azu commented on July 1, 2024

Array.prototype.toSorted() - JavaScript | MDN

Firefoxがまだ実装していない

from js-primer.

azu avatar azu commented on July 1, 2024

Firefox 115 for developers - Mozilla | MDN
Firefox 115でサポート

from js-primer.

azu avatar azu commented on July 1, 2024

notes: ベーシックなアイデアとして、TupleのアイデアをArrayに持ってくるところからスタートしてる。
withは他のやつとはちょっと別でTemporal proposalから持ってきてる

image

TypedArrayからtoSplicedが消えたのはTypedArrayにはspliceするようなものがないから

from js-primer.

azu avatar azu commented on July 1, 2024

Core-1 (non-mutating):

at
entries
every
filter
find
findIndex
findLast
findLastIndex
flat
flatMap
forEach
includes
indexOf
join
keys
lastIndexOf
map
reduce
reduceRight
slice
some
toLocaleString
toString
values
toSorted (TBC)
toRevered (TBC)
with (TBC)

Core-2 (mutating):

copyWithin
fill
reverse
sort

Array-1 (non-mutating):

concat
flat
flatMap

Array-2 (mutating):

pop
push
shift
splice
unshift

from js-primer.

azu avatar azu commented on July 1, 2024

配列、Record/Tuple、Iterator Helperがこの数年でまとまって変わるので、
大まかな方針を考えた。

  • Change Array by copyで配列に追加されるのはRecord/Tutpleからの輸入であるImmutable Methods #1667
  • Record/Tupleは新しいプリミティブなオブジェクトと配列的なもの #1678
  • Iterator HelpersはLazyなArray的なIterateメソッド #1601

これはそれぞれ次の章に対応する

  • Change Array by copy #1667 -> 配列の"破壊的なメソッドと非破壊的なメソッド"
  • Record/Tuple #1678 -> 新しい章を追加する
    • プリミティブなのでオブジェクトと配列と同じレベルであるが、実際にそれを並べてしまうと読みにくくなりそう
    • 配列で"破壊的なメソッドと非破壊的なメソッド"の流れから Tuple の章へといくのが自然である
    • ここでは出てから検討
  • Iterator Helpers #1601 -> ループと反復処理の応用的なもの

from js-primer.

azu avatar azu commented on July 1, 2024

image

https://excalidraw.com/#json=JJEaXI-pY8K5dc4pv6dvL,pNomwE3IAqmuK1yJW8ROuw
image

https://excalidraw.com/#json=UNoeeKEeTAJ2abTh7Ftfj,_CI_XZrD28MCLqM0Ikvhcw

from js-primer.

azu avatar azu commented on July 1, 2024
破壊的な方法 非破壊な方法
array[index] = item Array.prototype.with[ES2023]
Array.prototype.pop array.slice(0, -1)array.at(-1)[ES2022]
Array.prototype.push [...array, item][ES2015]
Array.prototype.splice Array.prototype.toSpliced[ES2023]
Array.prototype.reverse Array.prototype.toReversed[ES2023]
Array.prototype.sort Array.prototype.toSorted[ES2023]
Array.prototype.shift array.slice(1)array.at(0)[ES2022]
Array.prototype.unshift [item, ...array][ES2015]
Array.prototype.copyWithin[ES2015] なし
Array.prototype.fill[ES2015] なし

from js-primer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.