From 52d79dc28f893a99eb1efdb66351cafdc1d919cd Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 1 Feb 2022 02:13:17 +0900 Subject: 反復処理プロトコルの記事へのリンクフラグメントを修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../the_legacy_iterator_protocol/index.md | 16 ++++++++-------- .../javascript/reference/errors/is_not_iterable/index.md | 6 +++--- .../reference/global_objects/array/@@iterator/index.html | 2 +- .../reference/global_objects/generator/index.html | 2 +- .../global_objects/object/fromentries/index.html | 2 +- .../reference/global_objects/promise/all/index.md | 2 +- .../reference/global_objects/promise/any/index.md | 2 +- .../reference/global_objects/promise/race/index.md | 2 +- .../reference/statements/for-await...of/index.html | 2 +- .../javascript/reference/statements/for...of/index.html | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) (limited to 'files/ja/web/javascript/reference') diff --git a/files/ja/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.md b/files/ja/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.md index d3585d4ada..7acdc9f0ee 100644 --- a/files/ja/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.md +++ b/files/ja/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.md @@ -1,30 +1,30 @@ --- -title: 古いイテレータープロトコル +title: 古い反復子プロトコル slug: >- Web/JavaScript/Reference/Deprecated_and_obsolete_features/The_legacy_Iterator_protocol tags: - ES2015 - ガイド - JavaScript - - 古いイテレーター + - 古い反復子 translation_of: >- Web/JavaScript/Reference/Deprecated_and_obsolete_features/The_legacy_Iterator_protocol --- {{jsSidebar("More")}} -> **Warning:** 古いイテレータープロトコルは SpiderMonkey 固有の機能で、 Firefox 58 で削除されました。将来に向けた使用では、 [for..of](/ja/docs/Web/JavaScript/Reference/Statements/for...of) ループと[反復処理プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols)を使用することを検討してください。 +> **Warning:** 古い反復子プロトコルは SpiderMonkey 固有の機能で、 Firefox 58 で削除されました。将来に向けた使用では、 [for..of](/ja/docs/Web/JavaScript/Reference/Statements/for...of) ループと[反復処理プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols)を使用することを検討してください。 -## 非推奨の Firefox 専用イテレータープロトコル +## 非推奨の Firefox 専用反復子プロトコル -Firefox version 26 以前は、標準の [ES2015 のイテレータープロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols)に似た別のイテレータープロトコルを実装していました。 +Firefox version 26 以前は、標準の [ES2015 の反復子プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols)に似た別の反復子プロトコルを実装していました。 -オブジェクトが次の意味をもつ `next()` メソッドを実装している場合、そのオブジェクトは古いイテレーターで、反復処理の最後に {{jsxref("Global_Objects/StopIteration", "StopIteration")}} をスローします。 +オブジェクトが次の意味をもつ `next()` メソッドを実装している場合、そのオブジェクトは古い反復子で、反復処理の最後に {{jsxref("Global_Objects/StopIteration", "StopIteration")}} をスローします。 | プロパティ |値 | | -------- | ------------------------------------------------ | | `next` | 引数なしの関数で、値を返します。 | -### 古いイテレータープロトコルと ES2015 イテレータープロトコルとの違い +### 古い反復子プロトコルと ES2015 反復子プロトコルとの違い - 値はプレイスホルダーオブジェクトの `value` プロパティではなく、 `next` の呼び出しの返値として直接値が返されていました。 - 反復処理の終了は {{jsxref("Global_Objects/StopIteration", "StopIteration")}} オブジェクトをスローすることで表現されていました。 @@ -61,5 +61,5 @@ catch(e){ ## 関連情報 -- [イテレーターとジェネレーター](/ja/docs/Web/JavaScript/Guide/Iterators_and_Generators) +- [反復子とジェネレーター](/ja/docs/Web/JavaScript/Guide/Iterators_and_Generators) - 他の[非推奨の機能、廃止された機能](/ja/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features) diff --git a/files/ja/web/javascript/reference/errors/is_not_iterable/index.md b/files/ja/web/javascript/reference/errors/is_not_iterable/index.md index 3b3ffb43aa..27bf02056f 100644 --- a/files/ja/web/javascript/reference/errors/is_not_iterable/index.md +++ b/files/ja/web/javascript/reference/errors/is_not_iterable/index.md @@ -25,13 +25,13 @@ TypeError: 'x' is not a function or its return value is not iterable (Chrome) ## エラーの原因 -[for…of](/ja/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement) の右辺、 {{jsxref("Promise.all")}} や {{jsxref("TypedArray.from")}} などの引数として指定された値が[反復可能オブジェクト](/ja/docs/Web/JavaScript/Reference/Iteration_protocols)ではありません。反復可能なものは、{{jsxref("Array")}}、{{jsxref("String")}}、{{jsxref("Map")}} 等のような組み込み反復可能型や、ジェネレーターの結果、[反復可能プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol)を実装しているオブジェクトが成ることができます。

+[for…of](/ja/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement) の右辺、 {{jsxref("Promise.all")}} や {{jsxref("TypedArray.from")}} などの引数として指定された値が[反復可能オブジェクト](/ja/docs/Web/JavaScript/Reference/Iteration_protocols)ではありません。反復可能なものは、{{jsxref("Array")}}、{{jsxref("String")}}、{{jsxref("Map")}} 等のような組み込み反復可能型や、ジェネレーターの結果、[反復可能プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#反復可能_iterable_プロトコル)を実装しているオブジェクトが成ることができます。

## 例 ### オブジェクトのプロパティの反復処理 -JavaScript では、 {{jsxref("Object")}} は[反復可能プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol)を実装していない限り反復処理できません。したがって、オブジェクトのプロパティを反復処理するために [for…of](/ja/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement) を使用することはできません。

+JavaScript では、 {{jsxref("Object")}} は[反復可能プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#反復可能_iterable_プロトコル)を実装していない限り反復処理できません。したがって、オブジェクトのプロパティを反復処理するために [for…of](/ja/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement) を使用することはできません。

```js example-bad var obj = { 'France': 'Paris', 'England': 'London' }; @@ -127,7 +127,7 @@ Array.from(myEmptyIterable); // [] ## 関連情報 -- [反復可能プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) +- [反復可能プロトコル](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#反復可能_iterable_プロトコル) - {{jsxref("Object.keys")}} - {{jsxref("Object.entries")}} - {{jsxref("Map")}} diff --git a/files/ja/web/javascript/reference/global_objects/array/@@iterator/index.html b/files/ja/web/javascript/reference/global_objects/array/@@iterator/index.html index e092619e93..e4a067833b 100644 --- a/files/ja/web/javascript/reference/global_objects/array/@@iterator/index.html +++ b/files/ja/web/javascript/reference/global_objects/array/@@iterator/index.html @@ -16,7 +16,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@iterator ---
{{JSRef}}
-

@@iterator メソッドは反復プロトコルの一部であり、値の列を同期的に反復する方法を定義します。

+

@@iterator メソッドは反復プロトコルの一部であり、値の列を同期的に反復する方法を定義します。

@@iterator プロパティの初期値は {{jsxref("Array.prototype.values()", "values()")}} プロパティの初期値と同じ関数オブジェクトです。

diff --git a/files/ja/web/javascript/reference/global_objects/generator/index.html b/files/ja/web/javascript/reference/global_objects/generator/index.html index 3a182f7fa3..743055f6a7 100644 --- a/files/ja/web/javascript/reference/global_objects/generator/index.html +++ b/files/ja/web/javascript/reference/global_objects/generator/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Generator ---
{{JSRef}}
-

Generator オブジェクトは{{JSxRef("Statements/function*", "ジェネレーター関数", "", 1)}}によって返され、反復可能プロトコル反復子プロトコルの両方に準拠しています。

+

Generator オブジェクトは{{JSxRef("Statements/function*", "ジェネレーター関数", "", 1)}}によって返され、反復可能プロトコル反復子プロトコルの両方に準拠しています。

コンストラクター

diff --git a/files/ja/web/javascript/reference/global_objects/object/fromentries/index.html b/files/ja/web/javascript/reference/global_objects/object/fromentries/index.html index f7597861d6..e9c393e274 100644 --- a/files/ja/web/javascript/reference/global_objects/object/fromentries/index.html +++ b/files/ja/web/javascript/reference/global_objects/object/fromentries/index.html @@ -24,7 +24,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/fromEntries
iterable
-
反復処理プロトコルを実装している {{jsxref("Array")}} や {{jsxref("Map")}} やその他の反復処理可能なオブジェクトです。
+
反復処理プロトコルを実装している {{jsxref("Array")}} や {{jsxref("Map")}} やその他の反復処理可能なオブジェクトです。

返値

diff --git a/files/ja/web/javascript/reference/global_objects/promise/all/index.md b/files/ja/web/javascript/reference/global_objects/promise/all/index.md index c99546eb7a..fd056771a6 100644 --- a/files/ja/web/javascript/reference/global_objects/promise/all/index.md +++ b/files/ja/web/javascript/reference/global_objects/promise/all/index.md @@ -24,7 +24,7 @@ Promise.all(iterable); ### 引数 - `iterable` - - : [反復可能](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol)オブジェクト、例えば {{jsxref("Array")}} など。 + - : [反復可能](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#反復可能_iterable_プロトコル)オブジェクト、例えば {{jsxref("Array")}} など。 ### 返値 diff --git a/files/ja/web/javascript/reference/global_objects/promise/any/index.md b/files/ja/web/javascript/reference/global_objects/promise/any/index.md index d4a5946cf0..34ce72b4ab 100644 --- a/files/ja/web/javascript/reference/global_objects/promise/any/index.md +++ b/files/ja/web/javascript/reference/global_objects/promise/any/index.md @@ -23,7 +23,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/any ### 引数 - `iterable` - - : [反復可能](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol)オブジェクト、例えば {{JSxRef("Array")}} です。 + - : [反復可能](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#反復可能_iterable_プロトコル)オブジェクト、例えば {{JSxRef("Array")}} です。 ### 返値 diff --git a/files/ja/web/javascript/reference/global_objects/promise/race/index.md b/files/ja/web/javascript/reference/global_objects/promise/race/index.md index d831afb204..b48684a2d3 100644 --- a/files/ja/web/javascript/reference/global_objects/promise/race/index.md +++ b/files/ja/web/javascript/reference/global_objects/promise/race/index.md @@ -25,7 +25,7 @@ Promise.race(iterable); ### 引数 - `iterable` - - : 配列 ({{jsxref("Array")}}) などの反復可能なオブジェクト。[反復可能](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol)を確認してください。 + - : 配列 ({{jsxref("Array")}}) などの反復可能なオブジェクト。[反復可能](/ja/docs/Web/JavaScript/Reference/Iteration_protocols#反復可能_iterable_プロトコル)を確認してください。 ### 返値 diff --git a/files/ja/web/javascript/reference/statements/for-await...of/index.html b/files/ja/web/javascript/reference/statements/for-await...of/index.html index 4876cda803..e4a4f901e8 100644 --- a/files/ja/web/javascript/reference/statements/for-await...of/index.html +++ b/files/ja/web/javascript/reference/statements/for-await...of/index.html @@ -16,7 +16,7 @@ translation_of: Web/JavaScript/Reference/Statements/for-await...of ---
{{jsSidebar("Statements")}}
-

for await...ofは非同期および同期の反復可能オブジェクトを使用して、反復処理を行うループを作成します。たとえば、組込みの {{jsxref("String")}}, {{jsxref("Array")}}, 配列風オブジェクト (例えば {{jsxref("Functions/arguments", "arguments")}}, {{domxref("NodeList")}} など), {{jsxref("TypedArray")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, さらに、ユーザー定義の非同期・同期の反復可能オブジェクトを使用することができます。これはオブジェクトのそれぞれの識別可能なプロパティの値に対して、実行される文を表す独自の反復フックを呼び出します。 {{jsxref("Operators/await", "await")}} 演算子と同様に、この分は{{jsxref("Statements/async_function", "非同期関数", "", 1)}}の中でのみ使用されます。

+

for await...ofは非同期および同期の反復可能オブジェクトを使用して、反復処理を行うループを作成します。たとえば、組込みの {{jsxref("String")}}, {{jsxref("Array")}}, 配列風オブジェクト (例えば {{jsxref("Functions/arguments", "arguments")}}, {{domxref("NodeList")}} など), {{jsxref("TypedArray")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, さらに、ユーザー定義の非同期・同期の反復可能オブジェクトを使用することができます。これはオブジェクトのそれぞれの識別可能なプロパティの値に対して、実行される文を表す独自の反復フックを呼び出します。 {{jsxref("Operators/await", "await")}} 演算子と同様に、この分は{{jsxref("Statements/async_function", "非同期関数", "", 1)}}の中でのみ使用されます。

for await...of は非同期の反復可能オブジェクトではない非同期イテレーターでは動作しません。

diff --git a/files/ja/web/javascript/reference/statements/for...of/index.html b/files/ja/web/javascript/reference/statements/for...of/index.html index 39af8d9924..7173469f8d 100644 --- a/files/ja/web/javascript/reference/statements/for...of/index.html +++ b/files/ja/web/javascript/reference/statements/for...of/index.html @@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Statements/for...of ---
{{jsSidebar("Statements")}}
-

for...ofは、反復可能オブジェクト、たとえば組込みの {{jsxref("String")}}, {{jsxref("Array")}}, 配列状オブジェクト (例えば {{jsxref("Functions/arguments", "arguments")}} や {{domxref("NodeList")}}), {{jsxref("TypedArray")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, およびユーザー定義の反復可能オブジェクトなどに対して、反復的な処理をするループを作成します。これはオブジェクトのそれぞれの識別可能なプロパティの値に対して、実行される文を表す独自の反復フックを呼び出します。

+

for...ofは、反復可能オブジェクト、たとえば組込みの {{jsxref("String")}}, {{jsxref("Array")}}, 配列状オブジェクト (例えば {{jsxref("Functions/arguments", "arguments")}} や {{domxref("NodeList")}}), {{jsxref("TypedArray")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, およびユーザー定義の反復可能オブジェクトなどに対して、反復的な処理をするループを作成します。これはオブジェクトのそれぞれの識別可能なプロパティの値に対して、実行される文を表す独自の反復フックを呼び出します。

{{EmbedInteractiveExample("pages/js/statement-forof.html")}}
-- cgit v1.2.3-54-g00ecf