<commit_before>/*
 * IMPORTANT! Insert here your API key
 */
const API_KEY = null

const BASE_URL = 'https://api.stripe.com/v1/customers'

const headers = {
	'Authorization':`Bearer ${API_KEY}`,
	'Content-Type': 'application/x-www-form-urlencoded'
}

const encode = (key, value) =>
	`${encodeURIComponent(key)}=${encodeURIComponent(value)}`

const normalizeData = customer => [
	encode('account_balance', customer.balance * 1000),
	encode('description', customer.description),
	encode('email', customer.email),
	encode('metadata[firstName]', customer.firstName),
	encode('metadata[lastName]', customer.lastName)
].join('&')

export const request = (method, url, body) => {
  if (!API_KEY) {
    return Promise.reject('No API key found! check src/API.js and the README for more information.')
  }
	return fetch(url, { method, headers, body })
}

export const list = () => 
	request('GET', BASE_URL)

export const create = customer => 
	request('POST', BASE_URL, normalizeData(customer))

export const update = (id, customer) => 
	request('POST', `${BASE_URL}/${id}`, normalizeData(customer))

export const remove = id =>
	request('DELETE', `${BASE_URL}/${id}`)
<commit_msg>Fix tabs<commit_after>/*
 * IMPORTANT! Insert here your API key
 */
const API_KEY = null

const BASE_URL = 'https://api.stripe.com/v1/customers'

const headers = {
	'Authorization':`Bearer ${API_KEY}`,
	'Content-Type': 'application/x-www-form-urlencoded'
}

const encode = (key, value) =>
	`${encodeURIComponent(key)}=${encodeURIComponent(value)}`

const normalizeData = customer => [
	encode('account_balance', customer.balance * 1000),
	encode('description', customer.description),
	encode('email', customer.email),
	encode('metadata[firstName]', customer.firstName),
	encode('metadata[lastName]', customer.lastName)
].join('&')

export const request = (method, url, body) => {
  if (!API_KEY) {
    return Promise.reject('No API key found! check src/API.js and the README for more information.')
  }
  return fetch(url, { method, headers, body })
}

export const list = () => 
	request('GET', BASE_URL)

export const create = customer => 
	request('POST', BASE_URL, normalizeData(customer))

export const update = (id, customer) => 
	request('POST', `${BASE_URL}/${id}`, normalizeData(customer))

export const remove = id =>
	request('DELETE', `${BASE_URL}/${id}`)

{'fraction_non_alphanumeric': 0.17264957264957265, 'fraction_numerical': 0.004273504273504274, 'mean_word_length': 5.413698630136986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6380135', 'n_tokens_mistral': 767, 'n_tokens_neox': 757, 'n_words': 183}