1.0.4 • Published 6 years ago

extract-url-query v1.0.4

Weekly downloads
2
License
UNLICENSED
Repository
github
Last release
6 years ago

Extract Url Query

Extracts parameters from query parameters in a url. Why another extractor ?

  • It nicely decodes the URI.
  • I had nothing else to do.
  • It also fills a given object rather than blindly giving out an object.
  • Gives out wrongly formatted parameters in objectsWithoutKeys parameter

This is how you import:

var urlExtractor = require("extract-url-query")

This has 2 methods :

  • fillObject(url,obj) : fill a given object with parameters from the url. (Internally uses the second method)

        var objectToBeFilled = { 
            name:undefined,
            lastName:undefined,
            phoneNumber:undefined
        };
        urlExtractor.fillObject('google.com?name=John&lastName=Doe&address=not%20required',objectToBeFilled);
        // => (objectToBeFilled) {name:"John",lastName:"Doe",phoneNumber:undefined}
  • extractObject(url)

    ```node
        var obj = urlExtractor.extractObject('google.com?name=John&lastName=Doe&address=not%20required&blah');
        // => (obj) {name:"John",lastName:"Doe",address:"not required",objectsWithoutKeys:["blah"]}
    ```

    Suggestions welcome.

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago