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

## [](#divideby1)divideBy(Object, 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
    }
  ]
}
```