---
schema_version: "1"
id: fa2c3808ac00a870993036d8ce5c8244925ad77b1e9040ba77a18b92a0b0c1bd
title: divideBy
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-objects-functions-divideby.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-objects-functions-divideby
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 7b021dd65707c356ce0577fb6a6124e41d5c1234918f56b18313c5ee09dd9527
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
# divideBy

## [](#divideby1)divideBy(items: Object, amount: Number): Array<Object>

オブジェクトを、指定された数のキー - 値ペアを含むサブオブジェクトに分割します。

指定された数よりもオブジェクトに含まれるキー - 値ペアが少ない場合は、この関数はそれらのペアをオブジェクトに入れます。ペアが多すぎる場合は、余ったペアを別のオブジェクトに入れます。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>items</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">取得元オブジェクト内のキー - 値ペア。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>amount</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1 つのオブジェクトに使用できるキー - 値ペアの数。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、指定された ​`amount`​ に基づいてオブジェクトをサブオブジェクトに分割します。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import divideBy from dw::core::Objects
output application/json
---
{ "divideBy" : {"a": 1, "b" : true, "a" : 2, "b" : false, "c" : 3} divideBy 2 }
```

#### [](#出力)出力

```JSON
{
  "divideBy": [
    {
      "a": 1,
      "b": true
    },
    {
      "a": 2,
      "b": false
    },
    {
      "c": 3
    }
  ]
}
```