@transloadit/analyze-step
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -48,3 +48,3 @@ "use strict"; | ||
} | ||
if (countedArray.length === 1) { | ||
if (countedArray.length === 1 && typeof countedArray[0] === 'string') { | ||
return countedArray[0]; | ||
@@ -84,3 +84,3 @@ } | ||
if (typeof step[type] === 'string') { | ||
collection[type].push(`Filter by code evaluation`); | ||
collection[type]?.push(`Filter by code evaluation`); | ||
} | ||
@@ -146,3 +146,3 @@ else if (step[type] && Array.isArray(step[type])) { | ||
} | ||
collection[type].push(humanDescr); | ||
collection[type]?.push(humanDescr); | ||
lastTemplate = template; | ||
@@ -192,9 +192,9 @@ } | ||
} | ||
else if ('width' in step) { | ||
else if (step.width) { | ||
str += ` to ${step.width} pixels wide`; | ||
} | ||
else if ('height' in step) { | ||
else if (step.height) { | ||
str += ` to ${step.height} pixels high`; | ||
} | ||
else if ('crop' in step) { | ||
else if (step.crop) { | ||
str += ` to ${step.crop.x2 - step.crop.x1}×${step.crop.y2 - step.crop.y1} starting at ${step.crop.x1}×${step.crop.y1} from the top left`; | ||
@@ -205,2 +205,4 @@ } | ||
function humanPreset(step, extrameta = {}) { | ||
if (!step.preset) | ||
return ''; | ||
let str = inflect.humanize(step.preset.replace(/[-_]/g, ' ')); | ||
@@ -242,2 +244,4 @@ if (str.match(/^ipad/i)) { | ||
function humanFormat(step) { | ||
if (!step.format) | ||
return ''; | ||
let str = inflect.humanize(step.format.replace(/[-_]/g, ' ')); | ||
@@ -255,4 +259,4 @@ if (str.match(/^webp/i)) { | ||
const robot = robots[step.robot]; | ||
str = robot.purpose_words; | ||
if (robot.rname === '/video/encode') { | ||
str = robot?.purpose_words ?? ''; | ||
if (robot?.rname === '/video/encode') { | ||
if (JSON.stringify(step).match(/watermark/)) { | ||
@@ -305,3 +309,3 @@ str = `Watermark videos`; | ||
} | ||
if (robot.rname === '/audio/encode') { | ||
if (robot?.rname === '/audio/encode') { | ||
if ((0, lodash_1.has)(step, 'ffmpeg.ss') && (0, lodash_1.has)(step, 'ffmpeg.t')) { | ||
@@ -328,3 +332,3 @@ str = `Take a ${(0, lodash_1.get)(step, 'ffmpeg.t')}s clip out of audio at a specified offset`; | ||
} | ||
if (robot.rname === '/video/adaptive') { | ||
if (robot?.rname === '/video/adaptive') { | ||
if (step.technique === 'hls') { | ||
@@ -337,3 +341,3 @@ str = `Convert videos to HLS`; | ||
} | ||
if (robot.rname === '/video/merge') { | ||
if (robot?.rname === '/video/merge') { | ||
const types = (0, jsonpath_plus_1.JSONPath)({ path: '$..as', json: step }); | ||
@@ -347,6 +351,6 @@ if (types.length) { | ||
} | ||
if (robot.rname === '/file/filter') { | ||
if (robot?.rname === '/file/filter') { | ||
str = humanFilter(step); | ||
} | ||
if (robot.rname === '/audio/artwork') { | ||
if (robot?.rname === '/audio/artwork') { | ||
if ((0, lodash_1.get)(step, 'method') === 'insert') { | ||
@@ -359,3 +363,3 @@ str = `Insert audio artwork`; | ||
} | ||
if (robot.rname === '/image/resize') { | ||
if (robot?.rname === '/image/resize') { | ||
if ('watermark_url' in step) { | ||
@@ -362,0 +366,0 @@ str = `Watermark images`; |
@@ -13,3 +13,3 @@ { | ||
"main": "dist/analyzeStep.js", | ||
"typings": "dist/analyzeStep.d.ts", | ||
"types": "dist/analyzeStep.d.ts", | ||
"files": [ | ||
@@ -27,4 +27,4 @@ "dist" | ||
"dependencies": { | ||
"@transloadit/format-duration-ms": "^0.1.3", | ||
"@transloadit/prettier-bytes": "^0.1.3", | ||
"@transloadit/format-duration-ms": "^0.2.0", | ||
"@transloadit/prettier-bytes": "^0.2.0", | ||
"inflection": "^3.0.0", | ||
@@ -34,8 +34,8 @@ "jsonpath-plus": "^7.2.0", | ||
}, | ||
"version": "0.1.3", | ||
"gitHead": "b9159b6f037336d9325656c35b9b15023d5c1ce7", | ||
"version": "0.2.0", | ||
"gitHead": "3fbbb8c4c18eeb9b9de5e3a5c022d46a7cc40800", | ||
"devDependencies": { | ||
"@types/jsonpath": "^0.2.0", | ||
"@types/lodash": "^4" | ||
"@types/jsonpath": "^0.2.4", | ||
"@types/lodash": "^4.14.202" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65924
6
413
1
+ Added@transloadit/format-duration-ms@0.2.0(transitive)
+ Added@transloadit/prettier-bytes@0.2.0(transitive)
- Removed@transloadit/format-duration-ms@0.1.3(transitive)
- Removed@transloadit/prettier-bytes@0.1.3(transitive)