See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| let isRefreshing = false; | |
| let refreshSubscribers = []; | |
| const instance = axios.create({ | |
| baseURL: Config.API_URL, | |
| }); | |
| instance.interceptors.response.use(response => { | |
| return response; | |
| }, error => { |
| { | |
| "AC": "+247-####", | |
| "AD": "+376-###-###", | |
| "AE": "+971-5#-###-####", | |
| "AE": "+971-#-###-####", | |
| "AF": "+93-##-###-####", | |
| "AG": "+1(268)###-####", | |
| "AI": "+1(264)###-####", | |
| "AL": "+355(###)###-###", | |
| "AM": "+374-##-###-###", |
| { | |
| "scripts": { | |
| "build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min", | |
| "build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015", | |
| "build:esm": "tsc --module es2015 --target es5 --outDir dist/esm", | |
| "build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs", | |
| "build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js", | |
| "build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments --o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz", | |
| } | |
| } |
| import React, {Component} from 'react'; | |
| import differenceInSeconds from 'date-fns/difference_in_seconds'; | |
| import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; | |
| class TimeAgo extends Component { | |
| componentDidMount() { | |
| if (this.props.isLive) { | |
| this.updateTime(); | |
| } |
| /** | |
| * Plural forms for russian words | |
| * @param {Integer} count quantity for word | |
| * @param {Array} words Array of words. Example: ['депутат', 'депутата', 'депутатов'], ['коментарий', 'коментария', 'комментариев'] | |
| * @return {String} Count + plural form for word | |
| */ | |
| function pluralize(count, words) { | |
| var cases = [2, 0, 1, 1, 1, 2]; | |
| return count + ' ' + words[ (count % 100 > 4 && count % 100 < 20) ? 2 : cases[ Math.min(count % 10, 5)] ]; | |
| } |
| IE6 Only | |
| ================== | |
| _selector {...} | |
| IE6 & IE7 | |
| ================== | |
| *html or { _property: } | |
| IE7 Only | |
| ================== |
| function sec2time(timeInSeconds) { | |
| var pad = function(num, size) { return ('000' + num).slice(size * -1); }, | |
| time = parseFloat(timeInSeconds).toFixed(3), | |
| hours = Math.floor(time / 60 / 60), | |
| minutes = Math.floor(time / 60) % 60, | |
| seconds = Math.floor(time - minutes * 60), | |
| milliseconds = time.slice(-3); | |
| return pad(hours, 2) + ':' + pad(minutes, 2) + ':' + pad(seconds, 2) + ',' + pad(milliseconds, 3); | |
| } |
While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.
Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.
lib/ is intended for code that can run as-issrc/ is intended for code that needs to be manipulated before it can be used