Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ Tips from open-source: An Object with Map and Set.

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š Tips from open-source: An Object with Map and Set.


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

This tip is picked from Next.js source code. In this article, you will learn how to use an Object with Map and Set in Javascript.

I found this unique Object with Map and Set in next/src/export/index.ts.

Object with Map and Set

Skimming through the code around this function, I quickly learnt that it is used for Telemetry tracking purposes.

Learn the best practices used in open source

telemetry usage

This just reminds me of usecase where I had to deal with file paths, text replacements with in a file (say .docx, .txt). For example, you have an object like below:

let fileCustomisations = {
  // Not an array but Set to avoid duplicate paths
  paths: new Set(),
  // This is where you will have file text replacements
  textReplacements: new Map(), 
  // I took a step further to include supported formats
  supportedFormats: \['.docx', '.txt'\] 
}

With this data structure, you have all the variables required to apply text replacements to the content in a file.

Conclusion:

Using the right data structure matters. To pick the right data structure, context matters. An Object with Set and Map in Javascript, I found it unique in the wild (well, itโ€™s Next.js source code).

I tend to use separate variables rather than defining an Object to consolidate Map and Set. If I were to mix these data structures in a single object, I would think twice about the context. One example I could think of is shown below:

let fileCustomisations = {
  // Not an array but Set to avoid duplicate paths
  paths: new Set(),
  // This is where you will have file text replacements
  textReplacements: new Map(), 
  // I took a step further to include supported formats
  supportedFormats: \['.docx', '.txt'\] 
}
...



๐Ÿ“Œ Medium CVE-2020-28281: Set-object-value project Set-object-value


๐Ÿ“ˆ 33.77 Punkte

๐Ÿ“Œ CVE-2022-44108 | pdftojson 94204bb Object.cc Object::copy(Object*) stack-based overflow


๐Ÿ“ˆ 27.85 Punkte

๐Ÿ“Œ Dynamoose up to 2.6.x lib/utils/object/set.ts dynamically-determined object attributes


๐Ÿ“ˆ 26.17 Punkte

๐Ÿ“Œ Help Needed: "Object reference not set to an instance of an object" Error in Visual Studio


๐Ÿ“ˆ 26.17 Punkte

๐Ÿ“Œ Linux Foundation Announces an Open Map Project and 'Open Metaverse Foundation'


๐Ÿ“ˆ 21.49 Punkte

๐Ÿ“Œ JavaScript's Grouping Methods: Object.groupBy and Map.groupBy ๐Ÿคฏ


๐Ÿ“ˆ 21.48 Punkte

๐Ÿ“Œ wp-google-map-plugin Plugin up to 2.3.9 on WordPress Map cross site request forgery


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ Zomato: Zomato Map server going out of memory while resizing map image


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ Valorant Icebox Map: Players Are Dodging The New Map In Ranked


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ Medium CVE-2021-30457: Id-map project Id-map


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ Medium CVE-2021-30456: Id-map project Id-map


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ Medium CVE-2021-30455: Id-map project Id-map


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ DOT To Map Out Nation's Time Zones After Report Shows No Official Map Exists


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ CVE-2023-47223 | WP Map Plugins Basic Interactive World Map Plugin up to 2.0 on WordPress cross site scripting


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ This absurd GMod map is 2,048 times the size of the universe, requires 12GB RAM minimum: "Probably the biggest map ever in videogame history"


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ Sort a Map in Go by Value (Sort Map by Value)


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ CVE-2024-22297 | Codeboxr CBX Map for Google Map & OpenStreetMap Plugin up to 1.1.11 on WordPress cross site scripting


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ The World Map with Many Facesโ€Šโ€”โ€ŠMap Projections


๐Ÿ“ˆ 20.85 Punkte

๐Ÿ“Œ Stick Fight๏ผšThe Game โ€“ Some Basic and Map Tips


๐Ÿ“ˆ 20.35 Punkte

๐Ÿ“Œ How to Use CSS object-fit and object-position


๐Ÿ“ˆ 20.33 Punkte

๐Ÿ“Œ How to Use Set and Map in JavaScript


๐Ÿ“ˆ 19.8 Punkte

๐Ÿ“Œ Set and Map in JavaScript: A Close Look


๐Ÿ“ˆ 19.8 Punkte

๐Ÿ“Œ Set and Map in JavaScript: A Close Look


๐Ÿ“ˆ 19.8 Punkte

๐Ÿ“Œ How to set up Alexa's new Map View, and why you'll need one of these iOS devices


๐Ÿ“ˆ 19.8 Punkte

๐Ÿ“Œ How to Use the JavaScript Map and Set Objects โ€“ Explained with Code Examples


๐Ÿ“ˆ 19.8 Punkte

๐Ÿ“Œ Castle Rock SNMPc up to 9.0.12.0/10.0.8 Map Object nodeimp.exe Text File memory corruption


๐Ÿ“ˆ 19.71 Punkte

๐Ÿ“Œ JS - Map & Symbol object


๐Ÿ“ˆ 19.71 Punkte

๐Ÿ“Œ The Intersection of Geocoding and Art with Open Street Map and Networkx


๐Ÿ“ˆ 18.62 Punkte

๐Ÿ“Œ Attribution is in the object: using RTF object dimensions to track APT phishing weaponizers


๐Ÿ“ˆ 18.56 Punkte

๐Ÿ“Œ VB2019 paper: Attribution is in the object: using RTF object dimensions to track APT phishing weaponizers


๐Ÿ“ˆ 18.56 Punkte











matomo