This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Math.floor(15.7784514 * 100) / 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Populates process.env from .env file | |
function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ { | |
let dotenvPath = path.resolve(process.cwd(), '.env') | |
let encoding /*: string */ = 'utf8' | |
let debug = false | |
if (options) { | |
if (options.path != null) { | |
dotenvPath = options.path | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @remove-on-eject-begin | |
/** | |
* Copyright (c) 2015-present, Facebook, Inc. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
*/ | |
// @remove-on-eject-end | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const dotenv = require('dotenv'); | |
const fs = require('fs'); // to check if the file exists | |
const path = require('path'); // to get the current path | |
module.exports = (env) => { | |
// Get the root path (assuming your webpack config is in the root of your project!) | |
const currentPath = path.join(__dirname); | |
// Create the fallback path (the production .env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const dotenv = require('dotenv'); | |
module.exports = () => { | |
// call dotenv and it will return an Object with a parsed key | |
const env = dotenv.config().parsed; | |
// reduce it to a nice object, the same as before | |
const envKeys = Object.keys(env).reduce((prev, next) => { | |
prev[`process.env.${next}`] = JSON.stringify(env[next]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remember to require this, because we DefinePlugin is a webpack plugin | |
const webpack = require('webpack'); | |
// return a function from the config file | |
// the `env` variable will be a simple Object: { API_URL: 'http://localhost:8000' } | |
// it will contain all the environment variables (that we set in package.json) as key/value pairs | |
module.exports = (env) => { | |
// this object is our actual webpack config | |
return { | |
plugins: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ICompareFunc } from '../interfaces/Util'; | |
export const removeNonPrimitiveDuplicate = (arr: any[], compareFunc: ICompareFunc) => { | |
return arr.reduce((unique, item) => { | |
let duplicated: boolean = false; | |
for(const key in unique) { | |
if (compareFunc(unique[key], item)) { | |
duplicated = true; | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function is from https://gist.github.com/nicbell/6081098 for purpose to compare whether | |
* two objects are value equal. Specially cater for nested object comparison | |
* | |
* For simple object comparison we can use: | |
* (a, b) => JSON.stringify(Object.entries(a).sort()) === JSON.stringify(Object.entries(b).sort()) | |
* | |
* @param obj1 The object is being compared | |
* @param obj2 The object is being compared | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Angular 2 decorators and services | |
*/ | |
import {Component} from '@angular/core'; | |
/** | |
* Include ScopedSelectors css to be injected in the template | |
* Webpack will process this CSS in module mode | |
* See the webpack.config.js in the root folder | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This file includes polyfills needed by Angular and is loaded before the app. | |
* You can add your own extra polyfills to this file. | |
* | |
* This file is divided into 2 sections: | |
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. | |
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main | |
* file. | |
* | |
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that |
NewerOlder