From 17bb1f15c62c7a9105e8a917225ffe97d6a14bc7 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 28 Jun 2015 22:27:21 +0900 Subject: [PATCH 01/12] Initial commit --- .gitignore | 4 +++ .npmignore | 5 +++ README.md | 64 ++++++++++++++++++++++++++++++++++++++ bower.json | 31 +++++++++++++++++++ circle.yml | 3 ++ compile | 12 ++++++++ fast-format.js | 26 ++++++++++++++++ fast-format.min.js | 4 +++ img/graph1.svg | 50 ++++++++++++++++++++++++++++++ img/graph2.svg | 51 ++++++++++++++++++++++++++++++ package.json | 34 ++++++++++++++++++++ test/test.html | 24 +++++++++++++++ test/test.js | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 385 insertions(+) create mode 100644 .gitignore create mode 100644 .npmignore create mode 100644 README.md create mode 100644 bower.json create mode 100644 circle.yml create mode 100755 compile create mode 100644 fast-format.js create mode 100644 fast-format.min.js create mode 100644 img/graph1.svg create mode 100644 img/graph2.svg create mode 100644 package.json create mode 100644 test/test.html create mode 100644 test/test.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..846060c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +benchmark +bower_components +node_modules diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..fb0d7c7 --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +.* +bower.json +*.yml +compile +test diff --git a/README.md b/README.md new file mode 100644 index 0000000..b22c1bf --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# fast-format [![Circle CI](https://circleci.com/gh/knowledgecode/fast-format.svg?style=shield)](https://circleci.com/gh/knowledgecode/fast-format) +This is a simplified version of Node.js `util.format()`. This supports only `%s` placeholder, but faster than that. This will be the best solution if you need speed rather than complex formatting. + +## Usage +Same as Node.js `util.format()`. +```js +format(formatString[, ...]) +``` + +## Example +```js +var s = format('%s, %s!', 'Hello', 'world'); +console.log(s); // => 'Hello, world!' +``` + +## Benchmark +```js +var i, len, s = Date.now(); +for (i = 0, len = 10000000; i < len; i++) { + format('i = %s, len = %s', i, len); +} +console.log(Date.now() - s); +``` + +*environment1: MacBook Air Early 2015 + Node.js v0.12.5* + + + +| module | time | +|-------------|-------------| +| fast-format | 2,072 msec | +| util.format | 11,571 msec | +| sprintf-js | 19,438 msec | + +--- +*environment2: Core i7 2.5GHz Windows 8.1 Pro + Internet Explorer 11* + + + +| module | time | +|-------------|-------------| +| fast-format | 25,302 msec | +| util.format | 40,550 msec | +| sprintf-js | 58,133 msec | + +[sprintf-js](https://github.com/alexei/sprintf.js) is a JavaScript sprintf implementation for the browser and Node.js. It is slow but might not be inevitable because a high functional module. + +## Installation +### via npm +```sh +npm install fast-format --save +``` + +### via bower +```sh +bower install fast-format +``` + +## Browser Support +Chrome, Firefox, Safari, Opera, and Internet Explorer 6+ + +## License +MIT + diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..dbcc5df --- /dev/null +++ b/bower.json @@ -0,0 +1,31 @@ +{ + "name": "fast-format", + "main": "fast-format.min.js", + "version": "0.1.0", + "homepage": "https://github.com/knowledgecode/fast-format", + "authors": [ + "knowledgecode " + ], + "description": "A simplified version of Node.js util.format()", + "moduleType": [ + "amd", + "globals", + "node" + ], + "ignore": [ + "**/.*", + "bower_components", + "compile", + "node_modules", + "test", + "*.json", + "*.yml" + ], + "keywords": [ + "fast", + "util", + "format", + "sprintf" + ], + "license": "MIT" +} diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..31badd0 --- /dev/null +++ b/circle.yml @@ -0,0 +1,3 @@ +machine: + node: + version: 0.12.0 diff --git a/compile b/compile new file mode 100755 index 0000000..0a32904 --- /dev/null +++ b/compile @@ -0,0 +1,12 @@ +#!/bin/sh -eu + +url="http://closure-compiler.appspot.com/compile" +dir=`dirname $0` +input="${dir}/fast-format.js" +output="${dir}/fast-format.min.js" +js_code=`cat $input` + +curl --silent \ + --data-urlencode "js_code=$js_code" \ + --data-urlencode "output_info=compiled_code" \ + $url > $output diff --git a/fast-format.js b/fast-format.js new file mode 100644 index 0000000..6aa9576 --- /dev/null +++ b/fast-format.js @@ -0,0 +1,26 @@ +/** + * @preserve fast-format.js (C) 2015 KNOWLEDGECODE | MIT + */ +(function (global) { + 'use strict'; + + var f = function (format) { + var i, len, argc = arguments.length, v = (format + '').split('%s'), r = argc ? v[0] : ''; + for (i = 1, len = v.length, argc--; i < len; i++) { + r += (i > argc ? '%s' : arguments[i]) + v[i]; + } + return r; + }; + + if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = f; + } else if (typeof global.define === 'function' && global.define.amd) { + global.define([], function () { + return f; + }); + } else { + global.format = f; + } + +}(this)); + diff --git a/fast-format.min.js b/fast-format.min.js new file mode 100644 index 0000000..502b958 --- /dev/null +++ b/fast-format.min.js @@ -0,0 +1,4 @@ +/* + fast-format.js (C) 2015 KNOWLEDGECODE | MIT +*/ +(function(a){var c=function(a){var b,c,d=arguments.length,e=(a+"").split("%s"),f=d?e[0]:"";b=1;c=e.length;for(d--;bd?"%s":arguments[b])+e[b];return f};"object"===typeof module&&"object"===typeof module.exports?module.exports=c:"function"===typeof a.define&&a.define.amd?a.define([],function(){return c}):a.format=c})(this); diff --git a/img/graph1.svg b/img/graph1.svg new file mode 100644 index 0000000..e122c5d --- /dev/null +++ b/img/graph1.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fast-format + util.format + sprintf-js + + + 0 + 15,000 + 30,000 + 45,000 + 60,000 + [msec] + + diff --git a/img/graph2.svg b/img/graph2.svg new file mode 100644 index 0000000..9f55bef --- /dev/null +++ b/img/graph2.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fast-format + util.format + + browserify + sprintf-js + + + 0 + 15,000 + 30,000 + 45,000 + 60,000 + [msec] + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..e8c279c --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "fast-format", + "version": "0.1.0", + "description": "A simplified version of Node.js util.format()", + "main": "fast-format.js", + "directories": { + "test": "test" + }, + "devDependencies": { + "expect.js": "^0.3.1", + "mocha": "^2.2.5", + "mocha-phantomjs": "^3.5.3" + }, + "scripts": { + "test": "mocha test/test.js && mocha-phantomjs test/test.html", + "compile": "./compile" + }, + "keywords": [ + "fast", + "util", + "format", + "sprintf" + ], + "author": "KNOWLEDECODE", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/knowledgecode/fast-format.git" + }, + "bugs": { + "url": "https://github.com/knowledgecode/fast-format/issues" + }, + "homepage": "https://github.com/knowledgecode/fast-format#readme" +} diff --git a/test/test.html b/test/test.html new file mode 100644 index 0000000..a6a0923 --- /dev/null +++ b/test/test.html @@ -0,0 +1,24 @@ + + + + + + + Mocha Tests + + +
+ + + + + + + + diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..eaecaa7 --- /dev/null +++ b/test/test.js @@ -0,0 +1,77 @@ +(function (global) { + 'use strict'; + + var expect = global.expect || require('expect.js'), + format = global.format || require('../fast-format'); + + describe('format', function () { + it('1 replace', function () { + expect(format('%s', 'hello')).to.eql('hello'); + }); + it('2 insert', function () { + expect(format('%shello', 'hello')).to.eql('hellohello'); + }); + it('3 append', function () { + expect(format('hello%s', 'hello')).to.eql('hellohello'); + }); + it('4 insert2', function () { + expect(format('hello%shello', 'hello')).to.eql('hellohellohello'); + }); + it('5 join', function () { + expect(format('%s%s', 'he', 'llo')).to.eql('hello'); + }); + it('6 replace2', function () { + expect(format(' %s %s ', 'he', 'llo')).to.eql(' he llo '); + }); + it('7 %s', function () { + expect(format('%s', '%s')).to.eql('%s'); + }); + it('8 number', function () { + expect(format('%s', 100)).to.eql('100'); + }); + it('9 boolean', function () { + expect(format('%s', true)).to.eql('true'); + }); + it('10 date', function () { + expect(format('%s', new Date(2015, 5, 28))).to.contain('Sun Jun 28 2015 00:00:00'); + }); + it('11 array', function () { + expect(format('%s', [1, 2, 3])).to.eql('1,2,3'); + }); + it('12 object', function () { + expect(format('%s', { key: 'value' })).to.eql('[object Object]'); + }); + it('13 NaN', function () { + expect(format('%s', NaN)).to.eql('NaN'); + }); + it('14 function', function () { + expect(format('%s', function () {})).to.eql('function () {}'); + }); + it('15 null', function () { + expect(format('%s', null)).to.eql('null'); + }); + it('16 undefined', function () { + expect(format('%s', undefined)).to.eql('undefined'); + }); + it('17 excess', function () { + expect(format('%s %s %s %s', '1', '2', '3', '4', '5')).to.eql('1 2 3 4'); + }); + it('18 deficiency', function () { + expect(format('%s %s %s %s', '1', '2', '3')).to.eql('1 2 3 %s'); + }); + it('19 no values', function () { + expect(format('%s %s %s %s')).to.eql('%s %s %s %s'); + }); + it('20 %', function () { + expect(format('%')).to.eql('%'); + }); + it('21 empty', function () { + expect(format()).to.eql(''); + }); + it('22 not supported', function () { + expect(format('%d, %j', 10, { key: 'value' })).to.eql('%d, %j'); + }); + }); + +}(this)); + From 32c0665465f3db30ba4a0bc1baebcecb4e90758e Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 28 Jun 2015 22:48:37 +0900 Subject: [PATCH 02/12] 0.1.0 --- .npmignore | 1 + bower.json | 1 + 2 files changed, 2 insertions(+) diff --git a/.npmignore b/.npmignore index fb0d7c7..6229389 100644 --- a/.npmignore +++ b/.npmignore @@ -2,4 +2,5 @@ bower.json *.yml compile +img test diff --git a/bower.json b/bower.json index dbcc5df..d1c9a85 100644 --- a/bower.json +++ b/bower.json @@ -16,6 +16,7 @@ "**/.*", "bower_components", "compile", + "img", "node_modules", "test", "*.json", From 9091f5c82fb3106bf4e0de5c0d68d71e71bebe33 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:28:20 +0900 Subject: [PATCH 03/12] Rename --- compile => compile.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename compile => compile.sh (100%) diff --git a/compile b/compile.sh similarity index 100% rename from compile rename to compile.sh From e4a843f899c4b9bc9c4e8790446db065f2d61aee Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:34:12 +0900 Subject: [PATCH 04/12] Update compile.sh --- compile.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile.sh b/compile.sh index 0a32904..df312cb 100755 --- a/compile.sh +++ b/compile.sh @@ -1,9 +1,9 @@ #!/bin/sh -eu -url="http://closure-compiler.appspot.com/compile" +url="https://closure-compiler.appspot.com/compile" dir=`dirname $0` -input="${dir}/fast-format.js" -output="${dir}/fast-format.min.js" +input=${dir}/$1 +output=${dir}/$2 js_code=`cat $input` curl --silent \ From 896e97bd3db54b1d690465e3ece151e038e8e717 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:34:12 +0900 Subject: [PATCH 05/12] Update .nomignore --- .npmignore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.npmignore b/.npmignore index e0f6eb0..fdc151e 100644 --- a/.npmignore +++ b/.npmignore @@ -1,8 +1,8 @@ +*.sh +*.yml .* benchmark -bower_components bower.json -*.yml -compile +bower_components img test From d32386b9306a94f1109debbd5af3a62889e1e5e1 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:34:12 +0900 Subject: [PATCH 06/12] Add format.compile() function --- fast-format.js | 32 ++++++++++++++++++++++++++++---- fast-format.min.js | 5 +++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/fast-format.js b/fast-format.js index 6aa9576..80f8b00 100644 --- a/fast-format.js +++ b/fast-format.js @@ -1,17 +1,41 @@ /** - * @preserve fast-format.js (C) 2015 KNOWLEDGECODE | MIT + * @preserve fast-format.js (C) KNOWLEDGECODE | MIT */ (function (global) { 'use strict'; var f = function (format) { - var i, len, argc = arguments.length, v = (format + '').split('%s'), r = argc ? v[0] : ''; - for (i = 1, len = v.length, argc--; i < len; i++) { - r += (i > argc ? '%s' : arguments[i]) + v[i]; + var argc = arguments.length, v = (argc ? format + '' : '').split('%s'), i = 1, len = v.length, r = v[0]; + if (argc > len) { + argc = len; + } + while (i < argc) { + r += arguments[i] + v[i++]; + } + while (i < len) { + r += '%s' + v[i++]; } return r; }; + f.compile = function (format) { + var v = (arguments.length ? format + '' : '').split('%s'), len = v.length; + return function () { + var i = 0, argc = arguments.length, r = v[0]; + if (argc > len - 1) { + argc = len - 1; + } + while (i < argc) { + r += arguments[i] + v[++i]; + } + i++; + while (i < len) { + r += '%s' + v[i++]; + } + return r; + }; + }; + if (typeof module === 'object' && typeof module.exports === 'object') { module.exports = f; } else if (typeof global.define === 'function' && global.define.amd) { diff --git a/fast-format.min.js b/fast-format.min.js index 502b958..ecdbab7 100644 --- a/fast-format.min.js +++ b/fast-format.min.js @@ -1,4 +1,5 @@ /* - fast-format.js (C) 2015 KNOWLEDGECODE | MIT + fast-format.js (C) KNOWLEDGECODE | MIT */ -(function(a){var c=function(a){var b,c,d=arguments.length,e=(a+"").split("%s"),f=d?e[0]:"";b=1;c=e.length;for(d--;bd?"%s":arguments[b])+e[b];return f};"object"===typeof module&&"object"===typeof module.exports?module.exports=c:"function"===typeof a.define&&a.define.amd?a.define([],function(){return c}):a.format=c})(this); +(function(a){var f=function(a){var c=arguments.length,d=(c?a+"":"").split("%s"),b=1,g=d.length,e=d[0];for(c>g&&(c=g);bd-1&&(a=d-1);b Date: Sun, 5 Feb 2017 00:34:12 +0900 Subject: [PATCH 07/12] Append tests for format.compile() function --- test/test.js | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index eaecaa7..76074a5 100644 --- a/test/test.js +++ b/test/test.js @@ -73,5 +73,95 @@ }); }); -}(this)); + describe('format.compile', function () { + it('1 replace', function () { + var f = format.compile('%s'); + expect(f('hello')).to.eql('hello'); + }); + it('2 insert', function () { + var f = format.compile('%shello'); + expect(f('hello')).to.eql('hellohello'); + }); + it('3 append', function () { + var f = format.compile('hello%s'); + expect(f('hello')).to.eql('hellohello'); + }); + it('4 insert2', function () { + var f = format.compile('hello%shello'); + expect(f('hello')).to.eql('hellohellohello'); + }); + it('5 join', function () { + var f = format.compile('%s%s'); + expect(f('he', 'llo')).to.eql('hello'); + }); + it('6 replace2', function () { + var f = format.compile(' %s %s '); + expect(f('he', 'llo')).to.eql(' he llo '); + }); + it('7 %s', function () { + var f = format.compile('%s'); + expect(f('%s')).to.eql('%s'); + }); + it('8 number', function () { + var f = format.compile('%s'); + expect(f(100)).to.eql('100'); + }); + it('9 boolean', function () { + var f = format.compile('%s'); + expect(f(true)).to.eql('true'); + }); + it('10 date', function () { + var f = format.compile('%s'); + expect(f(new Date(2015, 5, 28))).to.contain('Sun Jun 28 2015 00:00:00'); + }); + it('11 array', function () { + var f = format.compile('%s'); + expect(f([1, 2, 3])).to.eql('1,2,3'); + }); + it('12 object', function () { + var f = format.compile('%s'); + expect(f({ key: 'value' })).to.eql('[object Object]'); + }); + it('13 NaN', function () { + var f = format.compile('%s'); + expect(f(NaN)).to.eql('NaN'); + }); + it('14 function', function () { + var f = format.compile('%s'); + expect(f(function () {})).to.eql('function () {}'); + }); + it('15 null', function () { + var f = format.compile('%s'); + expect(f(null)).to.eql('null'); + }); + it('16 undefined', function () { + var f = format.compile('%s'); + expect(f(undefined)).to.eql('undefined'); + }); + it('17 excess', function () { + var f = format.compile('%s %s %s %s'); + expect(f('1', '2', '3', '4', '5')).to.eql('1 2 3 4'); + }); + it('18 deficiency', function () { + var f = format.compile('%s %s %s %s'); + expect(f('1', '2', '3')).to.eql('1 2 3 %s'); + }); + it('19 no values', function () { + var f = format.compile('%s %s %s %s'); + expect(f()).to.eql('%s %s %s %s'); + }); + it('20 %', function () { + var f = format.compile('%'); + expect(f()).to.eql('%'); + }); + it('21 empty', function () { + var f = format.compile(); + expect(f()).to.eql(''); + }); + it('22 not supported', function () { + var f = format.compile('%d, %j'); + expect(f(10, { key: 'value' })).to.eql('%d, %j'); + }); + }); +}(this)); From ee4147a012f4d179c84e94a5f549f741fb5a5069 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:34:12 +0900 Subject: [PATCH 08/12] Update benchmark --- img/graph1.svg | 25 +++++++++++++------------ img/graph2.svg | 27 ++++++++++++++------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/img/graph1.svg b/img/graph1.svg index e122c5d..81c1723 100644 --- a/img/graph1.svg +++ b/img/graph1.svg @@ -30,21 +30,22 @@ - - - + + + - - fast-format - util.format - sprintf-js + + fast-format + + compile + fast-format + util.format - + 0 - 15,000 - 30,000 - 45,000 - 60,000 + 7,500 + 15,000 + 22,500 + 30,000 [msec] diff --git a/img/graph2.svg b/img/graph2.svg index 9f55bef..67b4864 100644 --- a/img/graph2.svg +++ b/img/graph2.svg @@ -30,22 +30,23 @@ - - - + + + - - fast-format - util.format - + browserify - sprintf-js + + fast-format + + compile + fast-format + util.format + + browserify - + 0 - 15,000 - 30,000 - 45,000 - 60,000 + 25,000 + 50,000 + 75,000 + 100,000 [msec] From c7b4963d9656cb1d6a0c0193eed062f58c831042 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:34:12 +0900 Subject: [PATCH 09/12] Update README.md --- README.md | 72 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index b22c1bf..b036558 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,73 @@ -# fast-format [![Circle CI](https://circleci.com/gh/knowledgecode/fast-format.svg?style=shield)](https://circleci.com/gh/knowledgecode/fast-format) -This is a simplified version of Node.js `util.format()`. This supports only `%s` placeholder, but faster than that. This will be the best solution if you need speed rather than complex formatting. +# fast-format +[![Circle CI](https://circleci.com/gh/knowledgecode/fast-format.svg?style=shield)](https://circleci.com/gh/knowledgecode/fast-format) + +This is a string formatter like `util.format()` method in Node.js, supports just only `%s` placeholder but accordingly faster than that. It will be one of the best solution if need a speed rather than complex formatting. ## Usage -Same as Node.js `util.format()`. +Same as `util.format()` method. ```js format(formatString[, ...]) ``` +If use one formatting repeatedly, recommended to compile the `formatString` in advance. +```js +format.compile(formatString) +``` + ## Example ```js -var s = format('%s, %s!', 'Hello', 'world'); +let s = format('%s, %s!', 'Hello', 'world'); console.log(s); // => 'Hello, world!' ``` +```js +let f = format.compile('%s, %s!'); +let s1 = f('Hello', 'world'); +console.log(s1); // => 'Hello, world!' +let s2 = f('Howdy', 'World'); +console.log(s2); // => 'Howdy, World!' +``` ## Benchmark ```js -var i, len, s = Date.now(); -for (i = 0, len = 10000000; i < len; i++) { +// Bench 1 +let s = Date.now(); +for (let i = 0, len = 100000000; i < len; i++) { format('i = %s, len = %s', i, len); } console.log(Date.now() - s); ``` +```js +// Bench 2 +let s = Date.now(); +let f = format.compile('i = %s, len = %s'); +for (let i = 0, len = 100000000; i < len; i++) { + f(i, len); +} +console.log(Date.now() - s); +``` -*environment1: MacBook Air Early 2015 + Node.js v0.12.5* +*environment1: Core i7 2.2GHz + Node.js v6.9.5* -| module | time | -|-------------|-------------| -| fast-format | 2,072 msec | -| util.format | 11,571 msec | -| sprintf-js | 19,438 msec | +| module | time | bench | +|-------------|-------------|:-----:| +| fast-format | 12,388 msec | 2 | +| fast-format | 22,039 msec | 1 | +| util.format | 28,659 msec | 1 | --- -*environment2: Core i7 2.5GHz Windows 8.1 Pro + Internet Explorer 11* +*environment2: Core i7 2.2GHz + Google Chrome 56.0.2924.87* -| module | time | -|-------------|-------------| -| fast-format | 25,302 msec | -| util.format | 40,550 msec | -| sprintf-js | 58,133 msec | +| module | time | bench | +|-------------|-------------|:-----:| +| fast-format | 12,898 msec | 2 | +| fast-format | 22,705 msec | 1 | +| util.format | 99,103 msec | 1 | -[sprintf-js](https://github.com/alexei/sprintf.js) is a JavaScript sprintf implementation for the browser and Node.js. It is slow but might not be inevitable because a high functional module. +The `util.format()` method was converted with `Browserify` to run on the browser. ## Installation ### via npm @@ -51,14 +75,18 @@ console.log(Date.now() - s); npm install fast-format --save ``` -### via bower +### via Bower ```sh bower install fast-format ``` +### directly (in case of the browser) +``` html + +``` + ## Browser Support -Chrome, Firefox, Safari, Opera, and Internet Explorer 6+ +Google Chrome, Firefox, Safari, Opera, Microsoft Edge and IE 6+ ## License MIT - From 7deb99c9b386113c43b79c2c75690753207b9b05 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:34:12 +0900 Subject: [PATCH 10/12] Bump version --- bower.json | 6 +++--- package.json | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index f6a6df7..8428f5d 100644 --- a/bower.json +++ b/bower.json @@ -1,12 +1,12 @@ { "name": "fast-format", "main": "fast-format.min.js", - "version": "0.1.1", + "version": "0.2.0", "homepage": "https://github.com/knowledgecode/fast-format", "authors": [ "knowledgecode " ], - "description": "A simplified version of Node.js util.format()", + "description": "A fast, simple string formatter like util.format() method in Node.js", "moduleType": [ "amd", "globals", @@ -15,11 +15,11 @@ "ignore": [ "**/.*", "bower_components", - "compile", "img", "node_modules", "test", "*.json", + "*.sh", "*.yml" ], "keywords": [ diff --git a/package.json b/package.json index 6e8ce74..2c14da1 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,19 @@ { "name": "fast-format", - "version": "0.1.1", - "description": "A simplified version of Node.js util.format()", + "version": "0.2.0", + "description": "A fast, simple string formatter like util.format() method in Node.js", "main": "fast-format.js", "directories": { "test": "test" }, "devDependencies": { "expect.js": "^0.3.1", - "mocha": "^2.2.5", - "mocha-phantomjs": "^3.5.3" + "mocha": "^2.5.3", + "mocha-phantomjs": "^4.1.0" }, "scripts": { "test": "mocha test/test.js && mocha-phantomjs test/test.html", - "compile": "./compile" + "compile": "./compile.sh fast-format.js fast-format.min.js" }, "keywords": [ "fast", From b0cf7f5a1b49246ea22f518df92d12ee680802a1 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:44:03 +0900 Subject: [PATCH 11/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b036558..0b1319d 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ console.log(Date.now() - s); *environment1: Core i7 2.2GHz + Node.js v6.9.5* - + | module | time | bench | |-------------|-------------|:-----:| @@ -59,7 +59,7 @@ console.log(Date.now() - s); --- *environment2: Core i7 2.2GHz + Google Chrome 56.0.2924.87* - + | module | time | bench | |-------------|-------------|:-----:| From 56f8de61ff494b5c5b0a507c2cf169cbb5340d96 Mon Sep 17 00:00:00 2001 From: knowledgecode Date: Sun, 5 Feb 2017 00:50:34 +0900 Subject: [PATCH 12/12] Update circle.yml --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 31badd0..e9bdad1 100644 --- a/circle.yml +++ b/circle.yml @@ -1,3 +1,3 @@ machine: node: - version: 0.12.0 + version: 6.1.0