I noticed something strange while building forms. Users were entering things like: test@gmail.com qwerty 123456 And everything passed validation. No errors. No warnings. But clearly… the data was useless. That’s when I realized: Validation checks syntax. But it doesn’t check intent. So I built input-sense — a small npm package that detects low-quality, meaningless inputs. It catches things like: • placeholder words • keyboard patterns • repeated inputs • and more… Now instead of just “valid / invalid”, I can actually tell if input is meaningful. 📦 Use it via npm: https://lnkd.in/d-ZCtDsF 💻 Explore more on GitHub: https://lnkd.in/dJigUUi7 Curious — how do you handle this in your projects? 👀 #javascript #npm #webdevelopment #buildinpublic #developers
Harshit Patle’s Post
More Relevant Posts
-
𝗪𝗵𝗮𝘁'𝘀 𝗗𝗧𝗢𝘀 𝗶𝗻 𝗡𝗲𝘀𝘁 𝗷𝘀 In NestJS, a 𝗗𝗧𝗢 (Data Transfer Object) is an object that defines how data is sent over the network. Think of it as a contract or a blueprint that specifies exactly what data a client (like a mobile app or a browser) must send to your server. While DTOs are a general software pattern, NestJS uses them powerfully to handle validation and type safety. 𝟭. 𝗪𝗵𝘆 𝗱𝗼 𝘄𝗲 𝘂𝘀𝗲 𝗗𝗧𝗢𝘀? Without a DTO, your application wouldn't know if the incoming data is correct. If a user tries to register but sends a "username" as a number instead of a string, your database might crash. DTOs help prevent this by: 𝗩𝗮𝗹𝗶𝗱𝗮𝘁𝗶𝗼𝗻: Ensuring the data has the right format, length, and type. 𝗗𝗮𝘁𝗮 𝗧𝗿𝗮𝗻𝘀𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻: Stripping away unwanted data that the client shouldn't be sending (e.g., trying to set their own isAdmin status). 𝗧𝘆𝗽𝗲 𝗦𝗮𝗳𝗲𝘁𝘆: Providing IntelliSense and auto-completion in your code so you know exactly what properties exist on the request body. 𝟮. 𝗖𝗹𝗮𝘀𝘀𝗲𝘀 𝘃𝘀. 𝗜𝗻𝘁𝗲𝗿𝗳𝗮𝗰𝗲𝘀 In NestJS, it is highly recommended to use Classes for DTOs rather than Interfaces. 𝗜𝗻𝘁𝗲𝗿𝗳𝗮𝗰𝗲𝘀 are removed during JavaScript compilation, meaning NestJS cannot check them at runtime. 𝗖𝗹𝗮𝘀𝘀𝗲𝘀 are preserved in the final code, allowing NestJS to use Pipe validation to check data as it arrives. #Programming #BackendDevelopment #TypeScript #NestJS
To view or add a comment, sign in
-
𝗕𝘂𝗶𝗹𝗱 𝗖𝗟𝗜 𝗧𝗼𝗼𝗹𝘀 𝗪𝗶𝘁𝗵 𝗡𝗼𝗱𝗲.𝗷𝘀 You write JavaScript daily. You build apps and APIs. Now build tools for yourself. Stop repeating tasks. Turn them into commands. Start your file with #!/usr/bin/env node. This tells the shell to use Node.js. Run chmod +x to make it executable. Use package.json. Add a bin field. Map your command name to the script. Run npm install -g . for global use. Use npm link for development. Process.argv is hard to read. Use yargs. - It handles flags. - It adds help menus. - It validates input. Keep output clean. - Add a --json flag for data. - Use console.error for errors. - Use exit code 0 for success. - Use exit code 1 for failure. Make your tool work with other tools. Use process.stdin to read input. This lets you pipe data into your tool. Avoid repetitive flags. Create a config file like .mytoolrc. Load it using fs and path. Set up autocomplete. Your tool is now a utility. Source: https://lnkd.in/gkh_6JJs
To view or add a comment, sign in
-
Small JavaScript bugs keep escaping to production and breaking critical user flows. Debugging inconsistent runtime behavior steals time from feature delivery. ────────────────────────────── Understanding Local Storage and Session Storage in JavaScript Dive into the differences between Local Storage and Session Storage and how to use them effectively. #javascript #webdevelopment #localstorage #sessionstorage ────────────────────────────── Core Concept Have you ever wondered how to store data on the client side? Local Storage and Session Storage are great tools that let you do just that, but they serve different purposes. Which one do you think you’d use more often? Key Rules • Local Storage persists even after the browser is closed. • Session Storage is cleared when the tab or window is closed. • Both are key-value pairs but have different lifetimes and scopes. 💡 Try This // Storing data in Local Storage localStorage.setItem('username', 'JohnDoe'); // Storing data in Session Storage sessionStorage.setItem('sessionID', '123456'); ❓ Quick Quiz Q: What happens to data in Session Storage when the tab is closed? A: It gets cleared. 🔑 Key Takeaway Choose Local Storage for persistent data and Session Storage for temporary session data!
To view or add a comment, sign in
-
🔥 **ES6 Power Moves: Spread, Rest & Template Literals – Level Up Your JS!** 🔥 Senior dev tip: These 3 ES6 features make your code *elegant* and *efficient*. Here's the deep dive with examples—read once, master forever. 🚀 **1. Spread (...) – Expand & Merge** 📈 Unpacks arrays/objects. *Use for:* Cloning, merging, function args. ```js const merged = [...arr1, ...arr2]; // Immutable magic! const copy = { ...obj, newProp: 'value' }; ``` *Why?* No mutations in React/Redux. 🛡️ **2. Rest (...) – Gather Args** 🥳 Collects "leftover" params into an array. *Use for:* Flexible functions. ```js function sum(...numbers) { return numbers.reduce((a,b)=>a+b); } sum(1,2,3,4); // 10 ``` Spread *expands*, Rest *gathers*. Opposite superpowers! 🔄 **3. Template Literals (``)** ✨ Multiline + `${expr}`. *Use for:* Dynamic strings, logs, queries. ```js const msg = `Hi ${name}! Age: ${age}`; // True multiline, no escapes! ``` *Why?* Readable APIs & configs. 🌍 **Pro takeaway:** Cut boilerplate, write cleaner code. Practice these daily! 💪 Which ES6 feature changed your workflow? Comment below! 👇 #JavaScript #ES6 #WebDev #MERN #CodingTips #100DaysOfCode #DeveloperLife
To view or add a comment, sign in
-
-
💡 “Just a Small Fix” Trap It’s Friday… Project is almost complete… Everything is stable… Weekend is already planned 😌🔥 Then at 4:00 PM 💥 “Just a small fix and a few improvements before release 🙂” At first: “No problem, quick update.” But reality disagrees 😭 That “small fix” becomes a chain reaction… API changes because it “can’t handle this case” Query rewritten because it wasn’t ready for real data DB indexing added “just in case” Frontend becomes “dynamic” 😭 Security suddenly becomes important Edge cases appear everywhere By the end… Nothing is small anymore 😅 And trust in the system is gone. You deploy it… You go home… 🌙 3:00 AM 💀 Brain: “What if filter is broken in production?” Then another thought: “what if that query is still slow under load…” 💭 Even after testing 100 times in production… your brain still whispers: “but what if you missed something?” 😭 💡 There is no “small fix”… On Fridays, “small fix” = full module rewrite in disguise 🔥 #SoftwareEngineering #DeveloperLife #ProgrammerHumor #CodingLife #WebDevelopment #BackendDevelopment #Laravel #PHP #FullStackDeveloper #SoftwareDeveloper #Debugging #ProductionIssues #TechHumor #FridayFeeling #WorkLifeBalance #DevLife #CleanCode #SystemDesign #ProgrammingMemes #TechCommunity
To view or add a comment, sign in
-
𝗧𝗵𝗲 𝗨𝗹𝗧𝗶𝗺𝗮𝗧𝗲 𝗚𝗨𝗶𝗱𝗲 𝗧𝗼 𝗕𝗨𝗶𝗟𝗗𝗶𝗡𝗚 𝗔 𝗖𝗨𝗦𝗧𝗢𝗠 𝗠𝗢𝗗𝗨𝗟𝗘 𝗟𝗢𝗔𝗗𝗘𝗥 You want to build a custom module loader for browser environments. This is a comprehensive guide to help you get started. Here's what you need to know: - JavaScript development has evolved over time - Modern environments support ES Modules (ESM) natively - Many developers still face challenges when creating custom module loaders You can use a custom module loader to: - Load modules on demand - Resolve dependencies - Execute modules in the correct order Here are some key features of a custom module loader: - Conditional loading based on environment - Dynamic module resolution - Lazy loading of dependencies To build a custom module loader, you need to: - Define modules - Resolve dependencies - Execute modules in the correct order You can use the following code as an example: ```javascript class ModuleLoader { constructor() { this.modules = {}; this.cache = {}; } define(name, moduleFunction) { this.modules[name] = moduleFunction; } require(name) { if (this.cache[name]) { return this.cache[name]; } if (!this.modules[name]) { throw new Error(`Module ${name} is not defined.`); } const moduleExports = {}; const module = { exports: moduleExports }; this.modules[name].call(module, moduleExports, this.require.bind(this)); this.cache[name] = module.exports; return module.exports; } } ``` You can also use advanced techniques like lazy loading and dynamic imports to optimize your module loader. Source: https://lnkd.in/gebibdti
To view or add a comment, sign in
-
Here’s a clean breakdown of how a request travels through a NestJS application: 👉 1. Middleware Handles logging, request parsing, and pre-processing before anything else. 👉 2. Guards Acts as a gatekeeper 🔐 — checks authentication & authorization (e.g., JWT validation). 👉 3. Pipes Validates and transforms incoming data (e.g., DTO validation, type conversion). 👉 4. Controller Receives the request and decides which logic to execute. 👉 5. Service (Business Logic) This is where the real work happens — database queries, API calls, etc. 👉 6. Interceptors Wrap around the response — useful for logging, formatting responses, or caching. 👉 7. Exception Filters Catch and handle errors globally to ensure clean and consistent API responses. ✅ Flow Summary: Middleware → Guards → Pipes → Controller → Service → Interceptors → Exception Filters → Response 💡 Why this matters? This layered architecture makes applications: ✔ Scalable ✔ Maintainable ✔ Testable #NestJS #NodeJS #BackendDevelopment #SoftwareEngineering #WebDevelopment #API #FullStackDeveloper #TechInterview #Coding #JavaScript #TypeScript #SystemDesign #Developers #Programming
To view or add a comment, sign in
-
-
Why you should NEVER delete items from an array while looping through it. I encountered a classic JavaScript "gotcha" that can catch even experienced developers off guard. Consider this code snippet: const numbers = [2, 4, 6, 8, 10]; numbers.forEach((num, index) => { if (num % 2 === 0) { numbers.splice(index, 1); } }); console.log(numbers); Pop Quiz: What does console.log(numbers) output? A) [] (Empty array - all evens removed) B) [4, 8] C) [2, 4, 6, 8, 10] D) ReferenceError The answer may not be what you'd expect. In fact, if you run this, you'll find that half of your data is still there! I've explained WHY this happens (and the 2-line fix) in the first comment. Check it out to avoid this silent bug in your next pull request. #JavaScript #WebDevelopment #CodingTips #CleanCode #SoftwareEngineering
To view or add a comment, sign in
-
Small JavaScript bugs keep escaping to production and breaking critical user flows. Debugging inconsistent runtime behavior steals time from feature delivery. ────────────────────────────── Unlocking the Power of Map and Set Data Structures in JavaScript Ever wondered how to manage collections of data more effectively? Let's dive into Maps and Sets! #javascript #datastructures #map #set ────────────────────────────── Core Concept Have you ever found yourself needing a way to store unique values or key-value pairs? Maps and Sets might just be the perfect solution for you! They offer powerful features that can simplify your data management. Key Rules • A Map stores key-value pairs where keys can be of any type. • A Set stores unique values, ensuring no duplicates. • Both structures maintain the insertion order, which can be very handy! 💡 Try This const myMap = new Map(); myMap.set('name', 'Alice'); myMap.set('age', 30); const mySet = new Set(); mySet.add(1); mySet.add(2); mySet.add(1); // won't be added again ❓ Quick Quiz Q: What will happen if you try to add a duplicate value to a Set? A: It will be ignored, as Sets only store unique values. 🔑 Key Takeaway Leverage Maps for key-value storage and Sets for unique collections to streamline your JavaScript code!
To view or add a comment, sign in
-
Code Privacy: Why Your Logic Needs a One-Way Mirror Ever felt like your code is too "exposed"? When every variable and function is out in the open, your logic is vulnerable to accidental changes. The Crux: - The "Building" Analogy: A nested function is like a room on the top floor. It can look out at the global data, but the outside world can never look in. - The Secure Handover: We use an "Outer" function to guard the data and an "Inner" function to do the secret work. - The Goal: Moving from cluttered scripts to Private, Encapsulated Logic. The Evolution: - We don't just nest functions for fun; we do it to build a "One-Way Mirror" where our internal logic stays hidden and our code stays clean. Full guide to building "Private Logic": https://lnkd.in/d2GuikmF #JavaScript #CleanCode #SoftwareArchitecture #ProgrammingTips
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Curious — how do you currently handle input validation in your projects? 👀