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

✨ improvements + TypeScript Types #50

Merged
merged 4 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
package-lock.json
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [0.2.1] - 2021-01-02
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove release notes for new version (I think it's nice to have releases not mixed with PR's that address different concerns)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


### Changed

- Move to GitHub Actions
- Improved `README.md`

## [0.2.0] - 2013-02-21

### Changed

- Refactor into function per-module idiomatic style.
- Improved test coverage.

## [0.1.0] - 2011-12-13

### Changed

- Minor project reorganization

## [0.0.3] - 2011-04-16

### Added

- Support for AMD module loaders

## [0.0.2] - 2011-04-16

### Changed

- Ported unit tests

### Removed

- Removed functionality that depended on Buffers

## [0.0.1] - 2011-04-15

### Added

- Initial release
20 changes: 0 additions & 20 deletions History.md

This file was deleted.

24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# querystring

[![GitHub Actions Status](https://github.com/Gozala/querystring/workflows/CI/badge.svg)](https://github.com/Gozala/querystring/actions)
[![GitHub Legacy Actions Status](https://github.com/Gozala/querystring/workflows/LEGACY/badge.svg)](https://github.com/Gozala/querystring/actions)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this belongs to PR which configures the actions (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this was supposed to be in GitHub Actions branch but since Readmd.md is changed to README.md in this one I thought of adding it here so there can be minimal diff, so first CI branch needs to get merged I guess

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's put this one on hold then for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

[![NPM](https://img.shields.io/npm/v/querystring.svg)](https://npm.im/querystring)
[![gzip](https://badgen.net/bundlephobia/minzip/querystring@latest)](https://bundlephobia.com/result?p=querystring@latest)

Node's querystring module for all engines.

_If you want to help with evolution of this package, please see https://github.com/Gozala/querystring/issues/20 PR's welcome!_

## 🔧 Install

```sh
npm i querystring
```

## 📖 Documentation

Refer to [Node's documentation for `querystring`](https://nodejs.org/api/querystring.html).

## 📜 License

MIT © [Gozala](https://github.com/Gozala)
20 changes: 0 additions & 20 deletions Readme.md

This file was deleted.

20 changes: 20 additions & 0 deletions decode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to keep typings in e.g. typings folder?

It'll be great to not mix them with regular modules (same as e.g. we keep tests in test folder) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried doing that, by specifying "typings" flag in package.json but seems it's not working also we have seprate file based import as well

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also we have separate file based import as well

What exactly do you mean by that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

means you can use same function multiple ways

import qs from "querystring"
import encode from "querystring/encode"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, there's seems no way to keep then in dedicated dir. It's a pity, anyway let's go with this

* parses a URL query string into a collection of key and value pairs
*
* @param qs The URL query string to parse
* @param sep The substring used to delimit key and value pairs in the query string
* @param eq The substring used to delimit keys and values in the query string
* @param options.decodeURIComponent The function to use when decoding percent-encoded characters in the query string
* @param options.maxKeys Specifies the maximum number of keys to parse. Specify 0 to remove key counting limitations default 1000
*/
export type decodeFuncType = (
qs?: string,
sep?: string,
eq?: string,
options?: {
decodeURIComponent?: Function;
maxKeys?: number;
}
) => Record<any, unknown>;

export default decodeFuncType;
18 changes: 18 additions & 0 deletions encode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* It serializes passed object into string
* The numeric values must be finite.
* Any other input values will be coerced to empty strings.
*
* @param obj The object to serialize into a URL query string
* @param sep The substring used to delimit key and value pairs in the query string
* @param eq The substring used to delimit keys and values in the query string
* @param name
*/
export type encodeFuncType = (
obj?: Record<any, unknown>,
sep?: string,
eq?: string,
name?: any
) => string;

export default encodeFuncType;
8 changes: 8 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import decodeFuncType from "./decode";
import encodeFuncType from "./encode";

export const decode: decodeFuncType;
export const parse: decodeFuncType;

export const encode: encodeFuncType;
export const stringify: encodeFuncType;