url-lib
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -139,3 +139,3 @@ /** | ||
parsedQueryParamsFromUrl, | ||
queryParamsAsArray, | ||
normalizedQueryParams, | ||
queryString; | ||
@@ -154,6 +154,6 @@ | ||
// Convert the query params into an array (if it already isn't) | ||
queryParamsAsArray = Array.isArray(queryParams) ? queryParams : [queryParams]; | ||
normalizedQueryParams = Array.isArray(queryParams) ? queryParams : [queryParams]; | ||
// Merge the URL query params to the additional query params | ||
queryParams = [parsedQueryParamsFromUrl].concat(queryParamsAsArray); | ||
queryParams = [parsedQueryParamsFromUrl].concat(normalizedQueryParams); | ||
@@ -160,0 +160,0 @@ // Serialize the query params to a query string |
{ | ||
"name": "url-lib", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A simple, lightweight string utility for Node and browsers that supports serializing and parsing URLs and query strings.", | ||
@@ -24,5 +24,5 @@ "main": "./index.js", | ||
"release": "npm run release-patch", | ||
"release-patch": "npm version patch && npm publish", | ||
"release-minor": "npm version minor && npm publish", | ||
"release-major": "npm version major && npm publish" | ||
"release-patch": "npm version patch --message 'Patch release v%s' && npm publish", | ||
"release-minor": "npm version minor --message 'Minor release v%s' && npm publish", | ||
"release-major": "npm version major --message 'Major release v%s' && npm publish" | ||
}, | ||
@@ -39,3 +39,4 @@ "repository": { | ||
"query+string", | ||
"resolve" | ||
"format", | ||
"fetch" | ||
], | ||
@@ -52,2 +53,3 @@ "author": "Ben Ilegbodu", | ||
"eslint": "^2.4.0", | ||
"eslint-config-benmvp": "^1.0.0", | ||
"istanbul": "^0.4.2", | ||
@@ -54,0 +56,0 @@ "mocha": "^2.4.5", |
@@ -8,3 +8,5 @@ # url-lib | ||
[![Dev Dependencies status](https://img.shields.io/david/dev/benmvp/url-lib.svg?style=flat-square)](https://david-dm.org/benmvp/url-lib#info=devDependencies) | ||
[![downloads](https://img.shields.io/npm/dm/url-lib.svg?style=flat-square)](http://npm-stat.com/charts.html?package=url-lib&from=2016-03-26) | ||
[![downloads](https://img.shields.io/npm/dt/url-lib.svg?style=flat-square)](http://npm-stat.com/charts.html?package=url-lib&from=2016-03-27) | ||
[![Maintenance Status](https://img.shields.io/badge/status-maintained-brightgreen.svg)](https://github.com/yannickcr/eslint-plugin-react/pulse) | ||
[![license](https://img.shields.io/npm/l/url-lib.svg?style=flat-square)](http://spdx.org/licenses/MIT) | ||
@@ -19,3 +21,3 @@ A simple, lightweight string utility for Node and browsers that supports serializing and parsing URLs and query strings. | ||
Install via [NPM](https://docs.npmjs.com/getting-started/installing-npm-packages-locally) (coming soon!): | ||
Install via [NPM](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): | ||
@@ -44,12 +46,13 @@ ```sh | ||
var url = urllib.formatUrl('http://www.benmvp.com/search', { | ||
var url = urllib.formatUrl('http://www.benmvp.com/search?sort=recent&results=20&pg=1', { | ||
sort: 'popular', // overwrites existing `sort` param in URL | ||
category: 'holiday', | ||
type: 'all', | ||
results: 20 | ||
results: 100 // overwrites existing `results` param in URL | ||
}); | ||
``` | ||
With the above code, `url` will be `'http://www.benmvp.com/search?category=holiday&type=all&results=20'`. | ||
With the above code, `url` will be `'http://www.benmvp.com/search?sort=popular&results=100&pg=1&category=holiday&type=all'` | ||
Check out the [docs](docs/) for more usage examples... | ||
Check out the [docs](docs/) for more usage examples or [try out `url-lib` in your browser!](https://tonicdev.com/npm/url-lib) | ||
@@ -56,0 +59,0 @@ ## API Docs |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23454
81
8