Code Monkey home page Code Monkey logo

url-params-helper's Introduction

url-params-helper

A JavaScript utility that allows for easy retrieval and manipulation of URL parameters.

Usage

getParams(
  [pageURL]     String indicating the URL to retrieve parameters from. Defaults to the current page URL.
)

Returns an object dictionary with key value pairs of URL parameter names and values, or null if there are no URL parameters.

getParam(
  param           String indicating the URL parameter name.
  [, pageURL]     String indicating the URL to retrieve parameters from. Defaults to the current page URL.
)

Returns the value of the specified URL parameter, or null if it does not exist and/or is empty.

buildQueryString(
  params          Object with key value pairs of URL parameter names and values.
)

Returns a query string with the specified URL parameters. Null-value parameters will be included in the returned query string, but undefined parameters will not.

buildQueryStringURL(
  params          Object with key value pairs of URL parameter names and values.
  [, pageURL]     String indicating the URL to retrieve parameters from. Defaults to the current page URL.
)

Returns a query string URL with the specified URL parameters. Null-value parameters will be included in the returned query string URL, but undefined parameters will not.

removeParam(
  param           String indicating the URL parameter name.
  [, pageURL]     String indicating the URL to retrieve parameters from. Defaults to the current page URL.
)

Returns a URL with the specified URL parameter removed.

replaceParam(
  param,          String indicating the URL parameter name.
  value           Mixed value for the URL parameter.
  [, pageURL]     String indicating the URL to retrieve parameters from. Defaults to the current page URL.
)

Returns a URL with the specified URL parameter replaced. If the URL parameter does not already exist, it will be set.

License

Copyright 2016 Alvin Teh. Licensed under the MIT license.

url-params-helper's People

Contributors

alvinteh avatar zyml avatar

Stargazers

eiurur avatar Sam Samskies avatar  avatar Chee Aun avatar Luís Rodrigues avatar  avatar

Watchers

James Cloos avatar  avatar

url-params-helper's Issues

Add ES2015 version support with "jsnext:main" in package.json

This would allow ES2015 aware bundlers and software to import the native code directly.

As you write the package in ES2015 in the first place this is really easy: in package.json it would just be this...

{
    "jsnext:main": "src/index.js"
}

tho obviously you'd have to not exclude that file from npm too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.