Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
timobraz
easypc
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
easypc
/
parser.ts
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
22 lines (20 loc) · 1.19 KB
main
Breadcrumbs
easypc
/
parser.ts
Copy path
Top
File metadata and controls
Code
Blame
22 lines (20 loc) · 1.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const inp =
"<CPU> 12900KF <GPU> 4090 <RAM> 32GB <MOBO> Z690 GAMING MAG <PSU> Corsair RM850x (2020) <STORAGE> 2x 1TB M.2-2280 PCIE 4.0 X4 NVME SSD <CASE> Corsair 4000D Airflow";
// console.log(parsePc(inp));
//input =<CPU> 12900KF <GPU> 4090 <RAM> 32GB <MOBO> Z690 GAMING MAG <PSU> Corsair RM850x (2020) <STORAGE> 2x 1TB M.2-2280 PCIE 4.0 X4 NVME SSD <CASE> Corsair 4000D Airflow
//write a function that parses the different pc parts into an object
function parsePCParts(input: string): any {
let pcParts: any = {};
let parts = input.split("<");
parts.shift();
parts.forEach((part) => {
let [type, ...rest] = part.split(">");
pcParts[type] = rest.join(">");
});
return pcParts;
}
// parsePCParts(inp);
// console.log(parsePCParts(inp)); // Test the parser
// const input = `<CPU>12900KF\n<GPU> RTX 4070 Ti\n<RAM> 32GB (2 x 16GB) G.Skill Ripjaws S5 6000MHz\n<MOBO> Asus ROG STRIX Z790-A GAMING WIFI ATX LGA1700\n<PSU> Corsair RM1000x (2021) 1000 W 80+ Gold Certified Fully Modular ATX Power Supply\n<STORAGE> 2 x Samsung 990 Pro 2TB M.2-2280 PCIe 4.0 X4 NVME Solid State Drive\n<CASE> Lian Li O11 Dynamic EVO ATX Mid Tower\n`;
// console.log(parsePCParts(input));
export default parsePCParts;
You can’t perform that action at this time.