<commit_before>import Rx from 'rxjs';
import { getColumns, addColumn } from '../actions/boardColumn';

const TIMEOUT = 1000;

const api = {
	getToggleEditItem(item) {
		return new Promise((resolve, reject) => {
			setTimeout(() => resolve(item), TIMEOUT);
		});
	},
	getColumns(observer) {
		const result = Rx.Observable.fromPromise(fetch('./client/mock/columns.json'));
		result.subscribe(observer)
	},
	addColumn(column) {
		return new Promise((resolve, reject) => {
			let columns = this.getStorage('columns');
			columns.push(column);
			this.setStorage('columns', JSON.stringify(columns));
			setTimeout(() => resolve(column), TIMEOUT);
		})
	},
	getStorage(key) {
		let items = sessionStorage.getItem(key);
		return items && JSON.parse(items) || null;
	},
	setStorage(key, value) {
		sessionStorage.setItem(key, value);
	}
};

export default api;<commit_msg>check if PRODUCTION mode<commit_after>import Rx from 'rxjs';
import { getColumns, addColumn } from '../actions/boardColumn';

const PRODUCTION = ENV.status === 'production'? true: false;
const TIMEOUT = 1000;
const api = {
	getToggleEditItem(item) {
		return new Promise((resolve, reject) => {
			setTimeout(() => resolve(item), TIMEOUT);
		});
	},
	getColumns(observer) {
		let result;
		if (PRODUCTION) {
			result = Rx.Observable.of([
				{
					"id": 1,
					"name": "Features"
				},
				{
					"id": 2,
					"name": "Todo"
				}
			]);
		} else {
			const apiUrl = './client/mock/columns.json';
			result = Rx.Observable.fromPromise(fetch(apiUrl))
								.concatMap((res) => res.json());
		}

		result.subscribe(observer);
	},
	addColumn(column) {
		return new Promise((resolve, reject) => {
			let columns = this.getStorage('columns');
			columns.push(column);
			this.setStorage('columns', JSON.stringify(columns));
			setTimeout(() => resolve(column), TIMEOUT);
		})
	},
	getStorage(key) {
		let items = sessionStorage.getItem(key);
		return items && JSON.parse(items) || null;
	},
	setStorage(key, value) {
		sessionStorage.setItem(key, value);
	}
};

export default api;
{'fraction_non_alphanumeric': 0.1705767350928641, 'fraction_numerical': 0.004887585532746823, 'mean_word_length': 4.017156862745098, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3708883', 'n_tokens_mistral': 773, 'n_tokens_neox': 665, 'n_words': 139}