<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Peter</title>
    <description>The latest articles on Forem by Peter (@petertoth-dev).</description>
    <link>https://forem.com/petertoth-dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3415923%2Fb56e3ae7-b01f-4768-8e1a-f77f57acc040.png</url>
      <title>Forem: Peter</title>
      <link>https://forem.com/petertoth-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/petertoth-dev"/>
    <language>en</language>
    <item>
      <title>Building a Content Transformation Pipeline</title>
      <dc:creator>Peter</dc:creator>
      <pubDate>Fri, 08 Aug 2025 00:19:13 +0000</pubDate>
      <link>https://forem.com/petertoth-dev/building-a-content-transformation-pipeline-23ne</link>
      <guid>https://forem.com/petertoth-dev/building-a-content-transformation-pipeline-23ne</guid>
      <description>&lt;p&gt;Processing unstructured content into a clean, well-formatted output is a common problem in software development. One elegant solution is the &lt;strong&gt;pipeline programming pattern&lt;/strong&gt;. A pipeline organizes data transformations into discrete, reusable steps, making the process more maintainable, testable, and extensible.&lt;/p&gt;

&lt;p&gt;In this article, we’ll implement a realistic example: transforming a messy email containing images, links, and text into a structured blog post.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Scenario
&lt;/h2&gt;

&lt;p&gt;We receive an email with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Images mixed with text
&lt;/li&gt;
&lt;li&gt;Links to various websites
&lt;/li&gt;
&lt;li&gt;Embedded YouTube links
&lt;/li&gt;
&lt;li&gt;Inconsistent HTML formatting
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our goal:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extract all images and store them in a gallery.
&lt;/li&gt;
&lt;li&gt;Detect links and turn them into clickable links, or embed if from special providers like YouTube.
&lt;/li&gt;
&lt;li&gt;Extract the clean, plain text body without formatting.
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Why Pipelines Work
&lt;/h2&gt;

&lt;p&gt;Instead of writing one large function that handles everything, we’ll create &lt;strong&gt;a sequence of small processors&lt;/strong&gt;. Each processor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes a standard input format
&lt;/li&gt;
&lt;li&gt;Outputs a standard format
&lt;/li&gt;
&lt;li&gt;Passes the result to the next processor
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This structure makes the process easier to read, debug, and extend.&lt;/p&gt;




&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;

&lt;p&gt;Here’s an example in modern JavaScript:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
javascript
class Pipeline {
  constructor(steps = []) {
    this.steps = steps;
  }
  add(step) {
    this.steps.push(step);
    return this;
  }
  run(input) {
    return this.steps.reduce((data, step) =&amp;gt; step(data), input);
  }
}

// Processing steps
function extractImages(data) {
  const images = [...data.raw.matchAll(/&amp;lt;img[^&amp;gt;]+src="([^"&amp;gt;]+)"/g)]
    .map(m =&amp;gt; m[1]);
  return { ...data, images };
}

function extractLinks(data) {
  const links = [...data.raw.matchAll(/https?:\/\/[^\s&amp;lt;]+/g)]
    .map(m =&amp;gt; m[0]);
  return { ...data, links };
}

function embedSpecialLinks(data) {
  const embeddedLinks = data.links.map(link =&amp;gt; {
    if (link.includes("youtube.com")) {
      return `&amp;lt;iframe src="${link}" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;`;
    }
    return `&amp;lt;a href="${link}"&amp;gt;${link}&amp;lt;/a&amp;gt;`;
  });
  return { ...data, embeddedLinks };
}

function cleanText(data) {
  const text = data.raw.replace(/&amp;lt;[^&amp;gt;]*&amp;gt;/g, "").trim();
  return { ...data, text };
}

// Build the pipeline
const contentPipeline = new Pipeline()
  .add(extractImages)
  .add(extractLinks)
  .add(embedSpecialLinks)
  .add(cleanText);

// Example usage
const rawEmail = `
  &amp;lt;p&amp;gt;Hello &amp;lt;b&amp;gt;World&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;img src="photo1.jpg" /&amp;gt;
  https://youtube.com/watch?v=abc123
  https://example.com
`;

const result = contentPipeline.run({ raw: rawEmail });

console.log(result);
/*
{
  raw: "...",
  images: ["photo1.jpg"],
  links: [
    "https://youtube.com/watch?v=abc123",
    "https://example.com"
  ],
  embeddedLinks: [
    "&amp;lt;iframe src=\"https://youtube.com/watch?v=abc123\" frameborder=\"0\"&amp;gt;&amp;lt;/iframe&amp;gt;",
    "&amp;lt;a href=\"https://example.com\"&amp;gt;https://example.com&amp;lt;/a&amp;gt;"
  ],
  text: "Hello World https://youtube.com/watch?v=abc123 https://example.com"
}
*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>React Native, Right Now! (RNRN) — A Starter Kit to Build Faster, Cleaner React Native Apps</title>
      <dc:creator>Peter</dc:creator>
      <pubDate>Wed, 06 Aug 2025 03:10:50 +0000</pubDate>
      <link>https://forem.com/petertoth-dev/react-native-right-now-rnrn-a-starter-kit-to-build-faster-cleaner-react-native-apps-55c4</link>
      <guid>https://forem.com/petertoth-dev/react-native-right-now-rnrn-a-starter-kit-to-build-faster-cleaner-react-native-apps-55c4</guid>
      <description>&lt;p&gt;Hey DEV community,&lt;/p&gt;

&lt;p&gt;If you’re working with React Native and want a faster way to get started — plus improve the way you write your code — I’d like to introduce you to React Native, Right Now! (RNRN), a starter kit designed with practical, real-world development in mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why RNRN?
&lt;/h2&gt;

&lt;p&gt;Get up and running fast with minimal setup, so you can focus on building your app, not your boilerplate.&lt;/p&gt;

&lt;p&gt;Write cleaner, easier-to-maintain code by following smart coding patterns and best practices baked right into the architecture.&lt;/p&gt;

&lt;p&gt;Learn better React Native habits that focus on state-driven logic and reduce the overuse of hooks.&lt;/p&gt;

&lt;p&gt;Skip Redux bloat — RNRN uses a lighter, more flexible state management approach with Zustand and Immer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s inside?
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🚀 Ready-to-use architecture with best practices baked in
🧩 TypeScript for type safety and better developer experience
🔄 State management with Zustand and Immer
📝 Form handling with React Hook Form
🎨 Theming system with light/dark mode support
🌐 HTTP client with built-in request/response handling
🔐 Authentication flow with token management
📱 Navigation using React Navigation
💾 Storage system with adapter pattern for different providers
🔌 Environment configuration for development and production
📍 Geolocation services with permission handling
🔒 Permissions management
📶 Connectivity monitoring
📝 Logging system
🧪 Testing setup with Jest
📅 Date handling with DayJS
🔤 Custom fonts 
🟪 Custom Icons/SVG
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And much more…&lt;/p&gt;

&lt;p&gt;You can check it out on GitHub: &lt;br&gt;
&lt;a href="https://github.com/petertoth-dev/rn-rn" rel="noopener noreferrer"&gt;https://github.com/petertoth-dev/rn-rn&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s coming next?
&lt;/h3&gt;

&lt;p&gt;CLI for automated component/state/API generation&lt;/p&gt;

&lt;p&gt;Premium components and themes&lt;/p&gt;

&lt;p&gt;Automated testing enhancements&lt;/p&gt;

&lt;p&gt;I’d love your feedback, issues, and contributions! If you find this useful, please give it a ⭐ on GitHub.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>typescript</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
