Commit d1e458aa authored by S Anand's avatar S Anand

Convert G.url.* into ES6 modules

parent e753c812
dist/G.min.js.gz
# Ignore node related items
node_modules/
npm-debug.log
# Creates G.js via ES6 modules
es6:
npm run build
DB_JS= lib/jquery/dbapi.js
# List of files to include in G.min.js, in sequence
......
import * as url from "./lib/url.js"
export {url}
......@@ -4,10 +4,7 @@
// Utility global functions for use in other components.
// Convention for all internal variables: _lower_case
var _decode_uri_component = function(s) { return decodeURIComponent(s.replace(/\+/g, '%20')) },
_encode_uri_component = encodeURIComponent,
_xmlns = 'http://www.w3.org/2000/xmlns/',
var _xmlns = 'http://www.w3.org/2000/xmlns/',
_xmlns_svg = 'http://www.w3.org/2000/svg',
_xmlns_xlink = 'http://www.w3.org/1999/xlink',
......
......@@ -32,6 +32,9 @@ _url_unparse,
_url_join,
_url_update
var _decode_uri_component = function(s) { return decodeURIComponent(s.replace(/\+/g, '%20')) },
_encode_uri_component = encodeURIComponent
_url_parse = function(str) {
/* Based on parseUri 1.2.2: http://blog.stevenlevithan.com/archives/parseuri
MIT License
......@@ -198,7 +201,7 @@ _url_update = function(args, mode) {
if (val === null) {
search_list[key] = []
} else {
if (!_is_array(val)) val = [val]
if (!Array.isArray(val)) val = [val]
if (!modes[key])
search_list[key] = val
else {
......@@ -256,3 +259,10 @@ _url_update = function(args, mode) {
self.search = qparts.join('&')
return self
}
export {
_url_parse as parse,
_url_unparse as unparse,
_url_join as join,
_url_update as update
}
{
"name": "g",
"version": "0.0.10",
"description": "Gramex library",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node node_modules/rollup/bin/rollup --format=umd --name=G --output=test/lib/G.js -- index.js"
},
"repository": {
"type": "git",
"url": "git@code.gramener.com:s.anand/g.git"
},
"author": "S Anand <s.anand@gramener.com>",
"license": "UNLICENSED",
"dependencies": {
"rollup": "^0.34.1"
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment