Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Автоматическая генерация плейсхолдеров .genSlots() #3

Open
TarasVasilev opened this issue Jun 4, 2021 · 0 comments

Comments

@TarasVasilev
Copy link

TarasVasilev commented Jun 4, 2021

Дружище, спасибо за пакет!

В RedBeanPHP есть метод генерации плейсхолдеров для элементов массива ::genSlots()
https://redbeanphp.com/index.php?p=/finding
Увы, я не обнаружил этот метод в данном пакете.

Для себя на скорую руку набросал такую функцию, но надеюсь в скором времени метод R.genSlots() будет включен ваш пакет:

async function genSlots (array = []) {
  let placeholders = '';
  if (Array.isArray(array)) {
    let array_length = array.length;
    if (array_length) {
      for (let i = 0; i < array_length; i++) {
        placeholders += (i == array_length - 1) ? '?' : '?, ';
      }
    }
  }
  return placeholders;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant