diff --git a/src/mock/d.js b/src/mock/d.js deleted file mode 100644 index 7c5edc7..0000000 --- a/src/mock/d.js +++ /dev/null @@ -1,23 +0,0 @@ -import { CITIES, DESCRIPTIONS } from '../const.js'; -import { getRandomArrayElement, getRandomInteger, createId } from '../util.js'; - -const MAX_INT = 1000; -const MIN_INT = 10; - -const createDestinationId = createId(); - -function createDestination() { - const city = getRandomArrayElement(CITIES); - return { - id: createDestinationId(), - description: getRandomArrayElement(DESCRIPTIONS), - name: city, - pictures: [ - { - src: `https://loremflickr.com/248/152?random=${getRandomInteger(MIN_INT, MAX_INT)}`, - description: city - }] - }; -} - -export {createDestination}; diff --git a/src/mock/destination.js b/src/mock/destination.js index c92fd85..083dee7 100644 --- a/src/mock/destination.js +++ b/src/mock/destination.js @@ -4,8 +4,6 @@ import { getRandomArrayElement, getRandomInteger } from '../util.js'; const MAX_INT = 1000; const MIN_INT = 10; -// const createDestinationId = createId(); - const destinations = [ { id: 'dest1', @@ -44,17 +42,3 @@ const destinations = [ ]; export {destinations}; - -// function createDestinations() { -// return { -// id: createDestinationId(), -// description: getRandomArrayElement(DESCRIPTIONS), -// name: getRandomArrayElement(CITIES), -// pictures: [ -// { -// src: `https://loremflickr.com/248/152?random=${getRandomInteger(MIN_INT, MAX_INT)}`, -// description: getRandomArrayElement(DESCRIPTIONS) -// }] -// }; -// } - diff --git a/src/mock/o.js b/src/mock/o.js deleted file mode 100644 index 17abf3f..0000000 --- a/src/mock/o.js +++ /dev/null @@ -1,35 +0,0 @@ -import { getRandomInteger, createId } from '../util.js'; -import { MAX_PRICE, MIN_PRICE } from '../const.js'; - -const MAX_OFFER_COUNT = 4; -const MIN_OFFER_COUNT = 0; - -const createOfferId = createId(); - -function createOffer(type) { - return { - type, - offers: - Array.from({length: getRandomInteger(MIN_OFFER_COUNT, MAX_OFFER_COUNT)}, () => ({ - id: createOfferId(), - title: 'Upgrade', - price: getRandomInteger(MIN_PRICE, MAX_PRICE) - })) - }; -} - -// function createArrayFromOffersId(offers) { -// //const offer = offers.find((elem) => elem.type === type); -// const arr = Array.from(offers, (x) => x.id); -// return arr; -// } - -// function createOffer() { -// return { -// id: createOfferId(), -// title: 'Upgrade', -// price: getRandomInteger(MIN_PRICE, MAX_PRICE) -// }; -// } - -export {createOffer}; diff --git a/src/mock/offers.js b/src/mock/offers.js index 2a0eed8..8768c6c 100644 --- a/src/mock/offers.js +++ b/src/mock/offers.js @@ -1,8 +1,6 @@ import { MAX_PRICE, MIN_PRICE } from '../const.js'; import { getRandomInteger } from '../util.js'; -// const createOfferId = createId(); - const offers = [ { type: 'taxi', @@ -34,16 +32,3 @@ const offers = [ ]; export {offers}; - -// function createDestinations() { -// return { -// type: getRandomArrayElement(POINT_TYPE), -// offers: [ -// { -// id: createOfferId(), -// title: 'Upgrade', -// price: getRandomInteger(MIN_PRICE, MAX_PRICE) -// }] -// }; -// } - diff --git a/src/mock/p.js b/src/mock/p.js deleted file mode 100644 index d331a48..0000000 --- a/src/mock/p.js +++ /dev/null @@ -1,21 +0,0 @@ -import { createId, getRandomInteger, getRandomArrayElement } from '../util.js'; -import { MAX_PRICE, MIN_PRICE } from '../const.js'; - -const isFavoriteValues = [true, false]; - -const getPointId = createId(); - -function createPoint(type, offersId, destinationId) { - return { - id: getPointId(), - basePrice: getRandomInteger(MIN_PRICE, MAX_PRICE), - dateFrom: '2019-07-10T22:55:56.845Z', - dateTo: '2019-07-11T11:22:13.375Z', - destination: destinationId, - isFavorite: getRandomArrayElement(isFavoriteValues), - offers: offersId, - type - }; -} - -export {createPoint}; diff --git a/src/util.js b/src/util.js index 705a460..0e3e79c 100644 --- a/src/util.js +++ b/src/util.js @@ -1,7 +1,5 @@ import dayjs from 'dayjs'; -//const DATE_FORMAT = 'MMM D'; - function formatEventDate(dueDate, dateFormat) { return dueDate ? dayjs(dueDate).format(dateFormat) : ''; }