New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kolibridev/contentful

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kolibridev/contentful - npm Package Compare versions

Comparing version 0.2.1 to 0.2.3

3

lib/config.js

@@ -16,3 +16,4 @@ 'use strict';

splitTagFields: ['socialMediaHandles'],
numberFields: ['price']
numberFields: ['price'],
durationFields: ['duration']
}, _config || {});

@@ -48,2 +48,12 @@ 'use strict';

const durationEnding = duration => duration > 1 ? 's' : '';
const processDurationFields = minutes => {
if (minutes < 60) {
return `${ minutes } minute${ durationEnding(minutes) }`;
}
return `${ moment.duration(minutes, 'minutes').asHours() } hour${ durationEnding(minutes) }`;
};
const processSplitTags = splitTags => {

@@ -94,3 +104,3 @@ const obj = {};

_.each(entry.fields, (value, field) => {
const isMarkdown = config.markdownContentTypes.indexOf(entry.sys.contentType.sys.id) !== -1 && config.markdownFields.indexOf(field) !== -1;
const isMarkdown = config.markdownContentTypes.indexOf(entry.sys && entry.sys.contentType && entry.sys.contentType.sys.id) !== -1 && config.markdownFields.indexOf(field) !== -1;

@@ -107,2 +117,4 @@ if (field === 'favicon') {

obj[field] = processNumberFields(value);
} else if (config.durationFields.indexOf(field) !== -1) {
obj[field] = processDurationFields(value);
} else if (isMarkdown) {

@@ -109,0 +121,0 @@ obj[field] = marked(value);

{
"name": "@kolibridev/contentful",
"version": "0.2.1",
"version": "0.2.3",
"description": "Transforms content from contentful",

@@ -5,0 +5,0 @@ "license": "ISC",

@@ -16,2 +16,3 @@

numberFields: ['price'],
durationFields: ['duration'],
}, _config || {})

@@ -46,2 +46,12 @@ const _ = require('lodash')

const durationEnding = (duration) => (duration > 1 ? 's' : '')
const processDurationFields = (minutes) => {
if (minutes < 60) {
return `${minutes} minute${durationEnding(minutes)}`
}
return `${moment.duration(minutes, 'minutes').asHours()} hour${durationEnding(minutes)}`
}
const processSplitTags = (splitTags) => {

@@ -92,3 +102,3 @@ const obj = {}

_.each(entry.fields, (value, field) => {
const isMarkdown = config.markdownContentTypes.indexOf(entry.sys.contentType.sys.id) !== -1 &&
const isMarkdown = config.markdownContentTypes.indexOf(entry.sys && entry.sys.contentType && entry.sys.contentType.sys.id) !== -1 &&
config.markdownFields.indexOf(field) !== -1

@@ -106,2 +116,4 @@

obj[field] = processNumberFields(value)
} else if (config.durationFields.indexOf(field) !== -1) {
obj[field] = processDurationFields(value)
} else if (isMarkdown) {

@@ -108,0 +120,0 @@ obj[field] = marked(value)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc