When designing code please keep these principles in mind
Here is an example of code which is not tree shakable.
export function query<T>(
t2-MacBook-Pro:location_app T2$ npm install | |
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible. | |
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0. | |
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible. | |
[email protected] node_modules/serve-favicon | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
└── [email protected] |
/** | |
* HomeController | |
* | |
* @description :: Server-side logic for managing Homes | |
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers | |
*/ | |
"use strict"; | |
const co = require('co'); | |
var map = require('../services/GoogleStaticMapAPI'); |
const browserify = require('browserify'), | |
babelify = require('babelify'), | |
compressor = require('node-minify'), | |
fs = require('fs'); | |
process.env.NODE_ENV = 'production'; | |
// for development enviroment | |
// "watch": "watchify -t babelify ./app/javascripts/components/message/app.js -o ./public/js/build.js -d", | |
// "build-css": "node-sass --include-path scss ./app/stylesheets/components/message/main.scss ./public/css/style.css", |
# encoding: utf-8 | |
namespace :json_params do | |
desc "create the definitions of json params" | |
task :generate => :environment do | |
# Custom Definitions | |
create('Session', "#{Rails.root}/app/controllers/params/session.rb", | |
nil, | |
{email: 'string', password: 'string'} |
/** | |
* @license Angular v6.0.0-beta.3-67cf712 | |
* (c) 2010-2018 Google, Inc. https://angular.io/ | |
* License: MIT | |
*/ | |
import { __assign, __extends } from 'tslib'; | |
import { Observable } from 'rxjs/Observable'; | |
import { merge } from 'rxjs/observable/merge'; | |
import { share } from 'rxjs/operator/share'; | |
import { Subject } from 'rxjs/Subject'; |
// library | |
type TransformFunction = (rawResponse: object) => object; | |
type TransformedEntity<T extends TransformFunction> = ReturnType<T | |
>; | |
// indivisual | |
function transform1(rawResponse: object) { | |
return { |
I hereby claim:
To claim this, I am signing this object:
// return immediately empty if source response empty array. | |
// otherwise adding some functions. | |
const Emptialbe = <T>(source: Observable<T[]>, additional: Observable<T[]>) => { | |
source.pipe( | |
switchMap(array => { | |
if (array.length === 0) { | |
return of(array) | |
} else { | |
return additional(array) | |
} |
const Observable$ = of(1).pipe( | |
tap(console.log), | |
delayWhenLoading(isLoading = true) | |
); | |
Observable$.subscribe(); | |
const delayWhenLoading = <T>(isLoading: boolean, delayTime: number = defaultDelayTime): OperatorFunction<T, T> => { | |
return pipe( | |
delayWhen(() => { |