---
schema_version: "1"
id: 18f949f72fa1ee3bde321ffbf10fed932ebfdfcb04cfac117c0c0b5d071d67cf
title: divideBy
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.7/dw-objects-functions-divideby.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.7/dw-objects-functions-divideby
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 210f83e6f8413cc0d577b84f6f4ed07c765d212084b1d746ed4346b4e058f489
description: MuleSoft Documentation Site
release: "2.7"
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
    }
  ]
}
```