Comments (8)
ES2023 introduces new array copying methods to JavaScript | Sonar
from js-primer.
Array.prototype.toSorted() - JavaScript | MDN
Firefoxがまだ実装していない
from js-primer.
Firefox 115 for developers - Mozilla | MDN
Firefox 115でサポート
from js-primer.
notes: ベーシックなアイデアとして、TupleのアイデアをArrayに持ってくるところからスタートしてる。
withは他のやつとはちょっと別でTemporal proposalから持ってきてる
![image](https://private-user-images.githubusercontent.com/19714/252128510-0b8e9f1d-7b51-476a-8947-497f937ffbb7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4MjYzNzIsIm5iZiI6MTcxOTgyNjA3MiwicGF0aCI6Ii8xOTcxNC8yNTIxMjg1MTAtMGI4ZTlmMWQtN2I1MS00NzZhLTg5NDctNDk3ZjkzN2ZmYmI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAxVDA5Mjc1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFmOWZlODYyOGViNGFkOWMwYWZmYmViMmQyMGJiMmYzMzA5N2FhMGZjY2Y3ZWI5YTAzZjk4OTAzNjUzZDhhZTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-0P2Rnf0rNPL3SGd3zqiYzWeY_hKA30GvoCCbd5F3g4)
- https://github.com/tc39/notes/blob/b28953a0c271896d9726e346c36f4f5535bfb091/meetings/2021-04/apr-20.md#change-array-by-copy
- https://github.com/tc39/notes/blob/b28953a0c271896d9726e346c36f4f5535bfb091/meetings/2022-03/mar-30.md#change-array-by-copy
https://www.dropbox.com/s/5rabrx387snkbfn/change_array_by_copy_at_tc39_march_2022.pdf?dl=0
TypedArrayからtoSplicedが消えたのはTypedArrayにはspliceするようなものがないから
from js-primer.
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.
配列、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.
https://excalidraw.com/#json=JJEaXI-pY8K5dc4pv6dvL,pNomwE3IAqmuK1yJW8ROuw
https://excalidraw.com/#json=UNoeeKEeTAJ2abTh7Ftfj,_CI_XZrD28MCLqM0Ikvhcw
from js-primer.
破壊的な方法 | 非破壊な方法 |
---|---|
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)
- 文章のライセンスをCC BYに変更 HOT 4
- markedjsのアップデート HOT 3
- [コラム] Node.jsのエラーファーストコールバックのimportについて
- utils.parseArgsの利用法を追記 HOT 6
- ECMAScript 2024の対応 HOT 9
- 脱字の報告(「関数とスコープ」) HOT 1
- Stage 2.7を追加する HOT 2
- ES2022: Error Cause HOT 4
- ES2024: Well-Formed Unicode Strings
- ES2024: array-grouping HOT 3
- mochaを `node:test` に変更する HOT 4
- Node.js 20 LTSへアップデートする
- Meta: Node.jsのユースケースの更新 HOT 1
- 配列の章でモバイルの表示が崩れている
- npm initとcommonjsの件を「コマンドライン引数を処理する」から「Node.jsでHello World」に移動する HOT 1
- Error: スクリーンショットを撮り直す
- REPLエディタがError Causeに対応していない HOT 2
- Open Collectiveの経費精算のルールを決める
- constについてお教えください。
- ループと反復処理 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-primer.