Please sanity test my query modification functions [Suggestion?]

オープン
#76 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, react-native
領域
mobile

調査の方向性

リポジトリのファイルやテストは指定されていません。まず既存の routing API と location-query API を確認し、次に提案されている addQuery、removeQuery、getQuery ヘルパーをプロジェクトで想定されている使い方と比較してください。完了とするには、このアプローチが適しているか、また必要であれば何を追加すべきかについて、メンテナーの判断が必要です。

索引モデルが issue の本文から書いたものです。

説明

Hi,

I threw together some quick & dirty helper functions for modifying the "query string".

I'm not very familiar with this project, and I was wondering:

Question: Is the following approach is (broadly) aligned with the intended usage of this project?

import qs from 'query-string';

/**
 * Warning: I don't know if anything relies on query-string format,
 * but I will keep for convention
 */

export const removeQuery = (prevLocation = {}, history, ...queryKeys) => {
  const location = Object.assign({}, prevLocation);
  const searchObj = qs.parse(location.search);
  queryKeys.forEach(q => delete searchObj[q]);
  location.search = qs.stringify(searchObj);
  history.push(location);
};

export const addQuery = (prevLocation = {}, history, queryObj) => {
  const location = Object.assign({}, prevLocation);
  const searchObj = Object.assign(
    qs.parse(location.search),
    queryObj
  );
  location.search = qs.stringify(searchObj);
  history.push(location);
};

export const getQuery = (prevLocation = {}, queryKey) => {
  const searchObj = qs.parse(prevLocation.search);
  return searchObj[queryKey];
};

Thanks

主要言語
JavaScript
スター
636
フォーク
37
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

jmurzy/react-router-native のほかの issue

jmurzy/react-router-native の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。