Skip to content

Commit

Permalink
some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Preet Shihn authored and Preet Shihn committed Jun 18, 2018
1 parent 6cb5a3e commit cb7aefc
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 149 deletions.
48 changes: 24 additions & 24 deletions bin/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ function isType(token, type) {
return token.type === type;
}
const PARAMS = {
A: { length: 7 },
a: { length: 7 },
C: { length: 6 },
c: { length: 6 },
H: { length: 1 },
h: { length: 1 },
L: { length: 2 },
l: { length: 2 },
M: { length: 2 },
m: { length: 2 },
Q: { length: 4 },
q: { length: 4 },
S: { length: 4 },
s: { length: 4 },
T: { length: 4 },
t: { length: 2 },
V: { length: 1 },
v: { length: 1 },
Z: { length: 0 },
z: { length: 0 }
A: 7,
a: 7,
C: 6,
c: 6,
H: 1,
h: 1,
L: 2,
l: 2,
M: 2,
m: 2,
Q: 4,
q: 4,
S: 4,
s: 4,
T: 4,
t: 2,
V: 1,
v: 1,
Z: 0,
z: 0
};
class ParsedPath {
constructor(d) {
Expand Down Expand Up @@ -66,7 +66,7 @@ class ParsedPath {
if (mode === 'BOD') {
if (token.text === 'M' || token.text === 'm') {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
else {
Expand All @@ -76,11 +76,11 @@ class ParsedPath {
}
else {
if (isType(token, this.NUMBER)) {
param_length = PARAMS[mode].length;
param_length = PARAMS[mode];
}
else {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
}
Expand All @@ -95,7 +95,7 @@ class ParsedPath {
return;
}
}
if (PARAMS[mode]) {
if (typeof PARAMS[mode] === 'number') {
const segment = { key: mode, data: params };
this.segments.push(segment);
index += param_length;
Expand Down
48 changes: 24 additions & 24 deletions dist/rough.es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@ var rough = (function () {
return token.type === type;
}
var PARAMS = {
A: { length: 7 },
a: { length: 7 },
C: { length: 6 },
c: { length: 6 },
H: { length: 1 },
h: { length: 1 },
L: { length: 2 },
l: { length: 2 },
M: { length: 2 },
m: { length: 2 },
Q: { length: 4 },
q: { length: 4 },
S: { length: 4 },
s: { length: 4 },
T: { length: 4 },
t: { length: 2 },
V: { length: 1 },
v: { length: 1 },
Z: { length: 0 },
z: { length: 0 }
A: 7,
a: 7,
C: 6,
c: 6,
H: 1,
h: 1,
L: 2,
l: 2,
M: 2,
m: 2,
Q: 4,
q: 4,
S: 4,
s: 4,
T: 4,
t: 2,
V: 1,
v: 1,
Z: 0,
z: 0
};

var ParsedPath = function () {
Expand Down Expand Up @@ -128,18 +128,18 @@ var rough = (function () {
if (mode === 'BOD') {
if (token.text === 'M' || token.text === 'm') {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
} else {
this.parseData('M0,0' + d);
return;
}
} else {
if (isType(token, this.NUMBER)) {
param_length = PARAMS[mode].length;
param_length = PARAMS[mode];
} else {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
}
Expand All @@ -153,7 +153,7 @@ var rough = (function () {
return;
}
}
if (PARAMS[mode]) {
if (typeof PARAMS[mode] === 'number') {
var segment = { key: mode, data: params };
this.segments.push(segment);
index += param_length;
Expand Down
2 changes: 1 addition & 1 deletion dist/rough.es5.min.js

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions dist/rough.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ var rough = (function () {
return token.type === type;
}
const PARAMS = {
A: { length: 7 },
a: { length: 7 },
C: { length: 6 },
c: { length: 6 },
H: { length: 1 },
h: { length: 1 },
L: { length: 2 },
l: { length: 2 },
M: { length: 2 },
m: { length: 2 },
Q: { length: 4 },
q: { length: 4 },
S: { length: 4 },
s: { length: 4 },
T: { length: 4 },
t: { length: 2 },
V: { length: 1 },
v: { length: 1 },
Z: { length: 0 },
z: { length: 0 }
A: 7,
a: 7,
C: 6,
c: 6,
H: 1,
h: 1,
L: 2,
l: 2,
M: 2,
m: 2,
Q: 4,
q: 4,
S: 4,
s: 4,
T: 4,
t: 2,
V: 1,
v: 1,
Z: 0,
z: 0
};
class ParsedPath {
constructor(d) {
Expand Down Expand Up @@ -69,7 +69,7 @@ var rough = (function () {
if (mode === 'BOD') {
if (token.text === 'M' || token.text === 'm') {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
else {
Expand All @@ -79,11 +79,11 @@ var rough = (function () {
}
else {
if (isType(token, this.NUMBER)) {
param_length = PARAMS[mode].length;
param_length = PARAMS[mode];
}
else {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
}
Expand All @@ -98,7 +98,7 @@ var rough = (function () {
return;
}
}
if (PARAMS[mode]) {
if (typeof PARAMS[mode] === 'number') {
const segment = { key: mode, data: params };
this.segments.push(segment);
index += param_length;
Expand Down
2 changes: 1 addition & 1 deletion dist/rough.min.js

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions dist/rough.umd.es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,26 @@
return token.type === type;
}
var PARAMS = {
A: { length: 7 },
a: { length: 7 },
C: { length: 6 },
c: { length: 6 },
H: { length: 1 },
h: { length: 1 },
L: { length: 2 },
l: { length: 2 },
M: { length: 2 },
m: { length: 2 },
Q: { length: 4 },
q: { length: 4 },
S: { length: 4 },
s: { length: 4 },
T: { length: 4 },
t: { length: 2 },
V: { length: 1 },
v: { length: 1 },
Z: { length: 0 },
z: { length: 0 }
A: 7,
a: 7,
C: 6,
c: 6,
H: 1,
h: 1,
L: 2,
l: 2,
M: 2,
m: 2,
Q: 4,
q: 4,
S: 4,
s: 4,
T: 4,
t: 2,
V: 1,
v: 1,
Z: 0,
z: 0
};

var ParsedPath = function () {
Expand Down Expand Up @@ -131,18 +131,18 @@
if (mode === 'BOD') {
if (token.text === 'M' || token.text === 'm') {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
} else {
this.parseData('M0,0' + d);
return;
}
} else {
if (isType(token, this.NUMBER)) {
param_length = PARAMS[mode].length;
param_length = PARAMS[mode];
} else {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
}
Expand All @@ -156,7 +156,7 @@
return;
}
}
if (PARAMS[mode]) {
if (typeof PARAMS[mode] === 'number') {
var segment = { key: mode, data: params };
this.segments.push(segment);
index += param_length;
Expand Down
2 changes: 1 addition & 1 deletion dist/rough.umd.es5.min.js

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions dist/rough.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
return token.type === type;
}
const PARAMS = {
A: { length: 7 },
a: { length: 7 },
C: { length: 6 },
c: { length: 6 },
H: { length: 1 },
h: { length: 1 },
L: { length: 2 },
l: { length: 2 },
M: { length: 2 },
m: { length: 2 },
Q: { length: 4 },
q: { length: 4 },
S: { length: 4 },
s: { length: 4 },
T: { length: 4 },
t: { length: 2 },
V: { length: 1 },
v: { length: 1 },
Z: { length: 0 },
z: { length: 0 }
A: 7,
a: 7,
C: 6,
c: 6,
H: 1,
h: 1,
L: 2,
l: 2,
M: 2,
m: 2,
Q: 4,
q: 4,
S: 4,
s: 4,
T: 4,
t: 2,
V: 1,
v: 1,
Z: 0,
z: 0
};
class ParsedPath {
constructor(d) {
Expand Down Expand Up @@ -72,7 +72,7 @@
if (mode === 'BOD') {
if (token.text === 'M' || token.text === 'm') {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
else {
Expand All @@ -82,11 +82,11 @@
}
else {
if (isType(token, this.NUMBER)) {
param_length = PARAMS[mode].length;
param_length = PARAMS[mode];
}
else {
index++;
param_length = PARAMS[token.text].length;
param_length = PARAMS[token.text];
mode = token.text;
}
}
Expand All @@ -101,7 +101,7 @@
return;
}
}
if (PARAMS[mode]) {
if (typeof PARAMS[mode] === 'number') {
const segment = { key: mode, data: params };
this.segments.push(segment);
index += param_length;
Expand Down
2 changes: 1 addition & 1 deletion dist/rough.umd.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit cb7aefc

Please sign in to comment.