From 2178204c14dd92ef50a24963fb65a6fc0efea52e Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 3 May 2019 00:31:15 +0200 Subject: [PATCH] Use spread operator in addGate This commit uses the spread operator instead of looping over the wires to populate the wireList. --- CHANGELOG.md | 4 ++++ packages/qiskit-sim/lib/Circuit.js | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3995358..2debe75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### ✏️ Changed + +- `@qiskit/qiskit-sim`: Use spread operator in addGate + ## [0.8.0] - 2019-04-25 ### 🎉 Added diff --git a/packages/qiskit-sim/lib/Circuit.js b/packages/qiskit-sim/lib/Circuit.js index 6e76af3..f7fa3d6 100644 --- a/packages/qiskit-sim/lib/Circuit.js +++ b/packages/qiskit-sim/lib/Circuit.js @@ -143,9 +143,7 @@ class Circuit { const wireList = []; if (Array.isArray(wires)) { - for (let i = 0; i < wires.length; i += 1) { - wireList.push(wires[i]); - } + wireList.push(...wires); } else { wireList.push(wires); }