🎨 add RawResource "type"
This commit is contained in:
@@ -8,6 +8,13 @@ import * as R from 'ramda'
|
|||||||
// resources: [Resource],
|
// resources: [Resource],
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// const RawResource = {
|
||||||
|
// title: String,
|
||||||
|
// desc: String,
|
||||||
|
// url: String,
|
||||||
|
// tags: [String]
|
||||||
|
// }
|
||||||
|
|
||||||
// const Resource = {
|
// const Resource = {
|
||||||
// title: String,
|
// title: String,
|
||||||
// cleanTitle: String,
|
// cleanTitle: String,
|
||||||
@@ -53,7 +60,7 @@ export const partiallyIncludesElOf = R.curry((list1, list2) =>
|
|||||||
list2)
|
list2)
|
||||||
)
|
)
|
||||||
|
|
||||||
// addCleanTitleAndPath :: Object -> Resource
|
// addCleanTitleAndPath :: RawResource -> Resource
|
||||||
const addCleanTitleAndPath = R.curry((slug, obj) => {
|
const addCleanTitleAndPath = R.curry((slug, obj) => {
|
||||||
const cleanTitle = cleanStringAndRemoveSpaces(obj.title)
|
const cleanTitle = cleanStringAndRemoveSpaces(obj.title)
|
||||||
return {
|
return {
|
||||||
@@ -63,7 +70,7 @@ const addCleanTitleAndPath = R.curry((slug, obj) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// transformToResources :: [Object] -> [Resource]
|
// transformToResources :: [RawResource] -> [Resource]
|
||||||
export const transformToResources = categories => {
|
export const transformToResources = categories => {
|
||||||
const resourcesLens = R.lens(R.prop('resources'), R.assoc('resources'))
|
const resourcesLens = R.lens(R.prop('resources'), R.assoc('resources'))
|
||||||
return R.map(category =>
|
return R.map(category =>
|
||||||
|
|||||||
Reference in New Issue
Block a user