louislam / louislam/redbean-node

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

Open
#3 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
33
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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

В 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;
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the public R API and the existing query or placeholder helpers, then compare their conventions with the requested genSlots() method. Implement the behavior shown in the issue for arrays and verify that empty and populated arrays produce the expected placeholder strings.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, sql, typescript
Domain
database
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.