Skip to content

Commit

Permalink
Merge pull request #5 from Marchrius/develop
Browse files Browse the repository at this point in the history
Merging Develop into Master
  • Loading branch information
Matteo Gaggiano authored Dec 19, 2016
2 parents acab418 + 6d9ae19 commit d1592fc
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 62 deletions.
125 changes: 65 additions & 60 deletions dist/angular-mimetype.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
.module('mg.mimetype.directives', []);

})();
(function() {
(function () {
'use strict';


angular
.module('mg.mimetype.filters', ['mg.mimetype.utils', 'mg.mimetype.constants']);

.module('mg.mimetype.providers', []);
})();
(function () {
(function() {
'use strict';


angular
.module('mg.mimetype.providers', []);
.module('mg.mimetype.filters', ['mg.mimetype.utils', 'mg.mimetype.constants']);

})();
(function() {
'use strict';
Expand Down Expand Up @@ -128,6 +128,59 @@
"offset":""
}
});
})();
(function() {
'use strict';

angular
.module('mg.mimetype.providers')
.provider('$mimeType', mimeTypeProvider);

function mimeTypeProvider($log) {
$log.debug("mimeTypeProvider initialized.");
}
})();
(function() {
'use strict';

angular
.module('mg.mimetype.utils')
.service('$util', UtilService);

function UtilService() {
var service = {};

service.hexToBase64 = hexToBase64;
service.base64ToHex = base64ToHex;
service.hop = hop;
service.escapeRegExp = escapeRegExp;

function hexToBase64(str) {
return btoa(String.fromCharCode.apply(null,
str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))
);
}

function base64ToHex(str, flag) {
flag = !!flag;
for (var i = 0, bin = atob(str.replace(/[ \r\n]+$/, "")), hex = []; i < bin.length; ++i) {
var tmp = bin.charCodeAt(i).toString(16);
if (tmp.length === 1) tmp = "0" + tmp;
hex[hex.length] = tmp;
}
return hex.join(flag ? " " : "");
}

function hop(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}

function escapeRegExp(string){
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

return service;
}
})();
(function () {
'use strict';
Expand Down Expand Up @@ -187,17 +240,6 @@
}
});
})();
(function() {
'use strict';

angular
.module('mg.mimetype.providers')
.provider('$mimeType', mimeTypeProvider);

function mimeTypeProvider($log) {
$log.debug("mimeTypeProvider initialized.");
}
})();
if (!window.atob) {
var tableStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var table = tableStr.split("");
Expand Down Expand Up @@ -230,45 +272,8 @@ if (!window.atob) {
};

}
(function() {
'use strict';

angular
.module('mg.mimetype.utils')
.service('$util', UtilService);

function UtilService() {
var service = {};

service.hexToBase64 = hexToBase64;
service.base64ToHex = base64ToHex;
service.hop = hop;
service.escapeRegExp = escapeRegExp;

function hexToBase64(str) {
return btoa(String.fromCharCode.apply(null,
str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))
);
}

function base64ToHex(str, flag) {
flag = !!flag;
for (var i = 0, bin = atob(str.replace(/[ \r\n]+$/, "")), hex = []; i < bin.length; ++i) {
var tmp = bin.charCodeAt(i).toString(16);
if (tmp.length === 1) tmp = "0" + tmp;
hex[hex.length] = tmp;
}
return hex.join(flag ? " " : "");
}

function hop(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}

function escapeRegExp(string){
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

return service;
}
})();
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(str2) {
return this.indexOf(str2) === 0;
};
}
2 changes: 1 addition & 1 deletion dist/angular-mimetype.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ var app = {
var source = {
scripts: [paths.scripts + 'core.module.js',
paths.scripts + '**/*.module.js',
paths.scripts + '**/*.constant.js',
paths.scripts + '**/*.provider.js',
paths.scripts + '**/*.factory.js',
paths.scripts + '**/*.service.js',
paths.scripts + '**/*.filter.js',
paths.scripts + '**/*.js'
]
};
Expand Down Expand Up @@ -117,6 +122,7 @@ gulp.task('clean', function(done) {

// build for production (minify)
gulp.task('build', gulpsync.sync([
'lint',
'prod',
'scripts:core'
]));
Expand All @@ -134,7 +140,7 @@ gulp.task('usesources', function() {

// default (no minify)
gulp.task('default', gulpsync.sync([
'scripts:core'
'build'
]));


Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions src/utils/polyfill/string.polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(str2) {
return this.indexOf(str2) === 0;
};
}

0 comments on commit d1592fc

Please sign in to comment.