Skip to content

Commit

Permalink
chore(all): prepare release 0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Feb 11, 2015
1 parent 869ab8d commit 1a19b98
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 68 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-path",
"version": "0.4.2",
"version": "0.4.3",
"description": "Utilities for path manipulation.",
"keywords": [
"aurelia",
Expand Down
17 changes: 9 additions & 8 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define(["exports"], function (exports) {

exports.relativeToFile = relativeToFile;
exports.join = join;
exports.buildParams = buildParams;
exports.buildQueryString = buildQueryString;
function trimDots(ary) {
var i, part;
for (i = 0; i < ary.length; ++i) {
Expand Down Expand Up @@ -92,38 +92,39 @@ define(["exports"], function (exports) {
if (obj == null) {
return obj + "";
}

return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj;
}

function buildParams(a, traditional) {
var prefix = undefined,
function buildQueryString(a, traditional) {
var prefix,
s = [],
add = function (key, value) {
value = typeof value === "function" ? value() : value == null ? "" : value;
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};

for (prefix in a) {
_buildParams(prefix, a[prefix], traditional, add);
_buildQueryString(prefix, a[prefix], traditional, add);
}

return s.join("&").replace(r20, "+");
}

function _buildParams(prefix, obj, traditional, add) {
var name = undefined;
function _buildQueryString(prefix, obj, traditional, add) {
var name;

if (Array.isArray(obj)) {
obj.forEach(function (v, i) {
if (traditional || rbracket.test(prefix)) {
add(prefix, v);
} else {
_buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
_buildQueryString(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
}
});
} else if (!traditional && type(obj) === "object") {
for (name in obj) {
_buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
_buildQueryString(prefix + "[" + name + "]", obj[name], traditional, add);
}
} else {
add(prefix, obj);
Expand Down
17 changes: 9 additions & 8 deletions dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports.relativeToFile = relativeToFile;
exports.join = join;
exports.buildParams = buildParams;
exports.buildQueryString = buildQueryString;
function trimDots(ary) {
var i, part;
for (i = 0; i < ary.length; ++i) {
Expand Down Expand Up @@ -91,38 +91,39 @@ function type(obj) {
if (obj == null) {
return obj + "";
}

return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj;
}

function buildParams(a, traditional) {
var prefix = undefined,
function buildQueryString(a, traditional) {
var prefix,
s = [],
add = function (key, value) {
value = typeof value === "function" ? value() : value == null ? "" : value;
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};

for (prefix in a) {
_buildParams(prefix, a[prefix], traditional, add);
_buildQueryString(prefix, a[prefix], traditional, add);
}

return s.join("&").replace(r20, "+");
}

function _buildParams(prefix, obj, traditional, add) {
var name = undefined;
function _buildQueryString(prefix, obj, traditional, add) {
var name;

if (Array.isArray(obj)) {
obj.forEach(function (v, i) {
if (traditional || rbracket.test(prefix)) {
add(prefix, v);
} else {
_buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
_buildQueryString(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
}
});
} else if (!traditional && type(obj) === "object") {
for (name in obj) {
_buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
_buildQueryString(prefix + "[" + name + "]", obj[name], traditional, add);
}
} else {
add(prefix, obj);
Expand Down
82 changes: 40 additions & 42 deletions dist/es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function join(path1, path2) {
if(!path2){
return path1;
}

urlPrefix = path1.indexOf('/') === 0 ? '/' : '';

url1 = path1.split('/');
Expand Down Expand Up @@ -84,70 +84,68 @@ export function join(path1, path2) {
return urlPrefix + url3.join('/').replace(/\:\//g, '://');;
}

let r20 = /%20/g,
rbracket = /\[\]$/,
class2type = {};
var r20 = /%20/g,
rbracket = /\[\]$/,
class2type = {};

"Boolean Number String Function Array Date RegExp Object Error".split(" ").forEach((name, i) => {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
})
'Boolean Number String Function Array Date RegExp Object Error'.split(' ').forEach((name, i) => {
class2type['[object ' + name + ']'] = name.toLowerCase();
});

function type ( obj ) {
if ( obj == null ) {
function type( obj ){
if (obj == null){
return obj + "";
}

// Support: Android<4.0 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call(obj) ] || "object" :
typeof obj;
return typeof obj === 'object' || typeof obj === 'function'
? class2type[ toString.call(obj) ] || 'object'
: typeof obj;
}

export function buildParams ( a, traditional ) {
let prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = typeof value === 'function' ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};

for ( prefix in a ) {
_buildParams( prefix, a[ prefix ], traditional, add );
export function buildQueryString(a, traditional){
var prefix,
s = [],
add = function(key, value) {
// If value is a function, invoke it and return its value
value = typeof value === 'function' ? value() : (value == null ? '' : value);
s[s.length] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
};

for(prefix in a){
_buildQueryString(prefix, a[prefix], traditional, add);
}

// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
return s.join('&').replace(r20, '+');
}

function _buildParams ( prefix, obj, traditional, add ) {
let name;
function _buildQueryString(prefix, obj, traditional, add){
var name;

if ( Array.isArray( obj ) ) {
if (Array.isArray(obj)){
// Serialize array item.
obj.forEach(( v, i ) => {
if ( traditional || rbracket.test( prefix ) ) {
obj.forEach((v, i) => {
if(traditional || rbracket.test(prefix)){
// Treat each array item as a scalar.
add( prefix, v );

} else {
add(prefix, v);
} else{
// Item is non-scalar (array or object), encode its numeric index.
_buildParams(
prefix + "[" + ( typeof v === "object" ? i : "" ) + "]",
_buildQueryString(
prefix + '[' + (typeof v === 'object' ? i : '') + ']',
v,
traditional,
add
);
}
});

} else if ( !traditional && type(obj) === "object" ) {
} else if (!traditional && type(obj) === 'object'){
// Serialize object item.
for ( name in obj ) {
_buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
for (name in obj) {
_buildQueryString(prefix + '[' + name + ']', obj[name], traditional, add);
}

} else {
} else{
// Serialize scalar item.
add( prefix, obj );
add(prefix, obj);
}
}
}
17 changes: 9 additions & 8 deletions dist/system/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ System.register([], function (_export) {

_export("join", join);

_export("buildParams", buildParams);
_export("buildQueryString", buildQueryString);

function trimDots(ary) {
var i, part;
Expand Down Expand Up @@ -88,38 +88,39 @@ System.register([], function (_export) {
if (obj == null) {
return obj + "";
}

return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj;
}

function buildParams(a, traditional) {
var prefix = undefined,
function buildQueryString(a, traditional) {
var prefix,
s = [],
add = function (key, value) {
value = typeof value === "function" ? value() : value == null ? "" : value;
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};

for (prefix in a) {
_buildParams(prefix, a[prefix], traditional, add);
_buildQueryString(prefix, a[prefix], traditional, add);
}

return s.join("&").replace(r20, "+");
}

function _buildParams(prefix, obj, traditional, add) {
var name = undefined;
function _buildQueryString(prefix, obj, traditional, add) {
var name;

if (Array.isArray(obj)) {
obj.forEach(function (v, i) {
if (traditional || rbracket.test(prefix)) {
add(prefix, v);
} else {
_buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
_buildQueryString(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
}
});
} else if (!traditional && type(obj) === "object") {
for (name in obj) {
_buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
_buildQueryString(prefix + "[" + name + "]", obj[name], traditional, add);
}
} else {
add(prefix, obj);
Expand Down
14 changes: 14 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
### 0.4.3 (2015-02-11)


#### Bug Fixes

* **all:** rename buildParams to buildQueryString ([e6d9ed33](http://github.com/aurelia/path/commit/e6d9ed334e2a3ad096c740996855213fee2c225d))
* **build:** add missing bower bump ([869ab8dd](http://github.com/aurelia/path/commit/869ab8ddac6aa73ca3006b0a03572bc32228f961))


#### Features

* **all:** add buildParams for building querystrings. ([52b22de6](http://github.com/aurelia/path/commit/52b22de6747043742d5096be952780ab58732020))


### 0.4.2 (2015-01-30)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-path",
"version": "0.4.2",
"version": "0.4.3",
"description": "Utilities for path manipulation.",
"keywords": [
"aurelia",
Expand Down

0 comments on commit 1a19b98

Please sign in to comment.