@raketa-builder/support 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @raketa-builder/support@0.3.0 build
2
+ > @raketa-builder/support@0.4.0 build
3
3
  > tsup src/index.js --format cjs --loader ".js=jsx"
4
4
 
5
5
  CLI Building entry: src/index.js
@@ -7,5 +7,5 @@ CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v6.5.0
8
8
  CLI Target: es6
9
9
  CJS Build start
10
- CJS dist/index.js 11.31 KB
11
- CJS ⚡️ Build success in 134ms
10
+ CJS dist/index.js 11.66 KB
11
+ CJS ⚡️ Build success in 31ms
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ __export(src_exports, {
57
57
  Image: () => Image_default,
58
58
  imagePlaceholder: () => imagePlaceholder_default,
59
59
  imageSrc: () => imageSrc_default,
60
+ isImagePresent: () => isImagePresent_default,
60
61
  toHTML: () => toHTML_default
61
62
  });
62
63
  module.exports = __toCommonJS(src_exports);
@@ -341,6 +342,21 @@ var toHTML = (string, inline = false) => {
341
342
  return inline ? parser.renderInline(string) : parser.render(string);
342
343
  };
343
344
  var toHTML_default = toHTML;
345
+
346
+ // src/isImagePresent.js
347
+ function isImagePresent(value) {
348
+ if (!value) {
349
+ return false;
350
+ }
351
+ if (value.hasOwnProperty("image")) {
352
+ return !!value.image;
353
+ }
354
+ if (typeof value === "string" && value) {
355
+ return true;
356
+ }
357
+ return !!value;
358
+ }
359
+ var isImagePresent_default = isImagePresent;
344
360
  // Annotate the CommonJS export names for ESM import in node:
345
361
  0 && (module.exports = {
346
362
  Container,
@@ -348,5 +364,6 @@ var toHTML_default = toHTML;
348
364
  Image,
349
365
  imagePlaceholder,
350
366
  imageSrc,
367
+ isImagePresent,
351
368
  toHTML
352
369
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/support",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -4,5 +4,14 @@ import imagePlaceholder from "./imagePlaceholder";
4
4
  import Container from "./Container";
5
5
  import EmbeddedVideo from "./EmbeddedVideo";
6
6
  import toHTML from "./toHTML";
7
+ import isImagePresent from "./isImagePresent";
7
8
 
8
- export { Image, imageSrc, imagePlaceholder, Container, EmbeddedVideo, toHTML };
9
+ export {
10
+ Image,
11
+ imageSrc,
12
+ imagePlaceholder,
13
+ isImagePresent,
14
+ Container,
15
+ EmbeddedVideo,
16
+ toHTML,
17
+ };
@@ -0,0 +1,20 @@
1
+ function isImagePresent(value) {
2
+ if (!value) {
3
+ return false;
4
+ }
5
+
6
+ // { image: {...} }
7
+ if (value.hasOwnProperty("image")) {
8
+ return !!value.image;
9
+ }
10
+
11
+ // https://placeholder.raketa.cloud/images/200
12
+ if (typeof value === "string" && value) {
13
+ return true;
14
+ }
15
+
16
+ // { file_segment: 2, name: "blabla.png" }
17
+ return !!value;
18
+ }
19
+
20
+ export default isImagePresent;