{"id":22960310,"url":"https://github.com/stringmanolo/cppjs","last_synced_at":"2025-04-02T02:43:23.680Z","repository":{"id":95119383,"uuid":"315608972","full_name":"StringManolo/cppjs","owner":"StringManolo","description":"Some Javascript Sintax Sugar for C++","archived":false,"fork":false,"pushed_at":"2020-11-29T18:30:07.000Z","size":793,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T17:45:02.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StringManolo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-24T11:19:34.000Z","updated_at":"2024-09-06T14:10:45.000Z","dependencies_parsed_at":"2023-05-26T19:15:32.845Z","dependency_job_id":null,"html_url":"https://github.com/StringManolo/cppjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StringManolo%2Fcppjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StringManolo%2Fcppjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StringManolo%2Fcppjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StringManolo%2Fcppjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StringManolo","download_url":"https://codeload.github.com/StringManolo/cppjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246746879,"owners_count":20827061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T18:32:34.794Z","updated_at":"2025-04-02T02:43:23.654Z","avatar_url":"https://github.com/StringManolo.png","language":"C++","readme":"# cppjs\nSome Javascript Sintax Sugar for C++\n\n### Notice:\nSince you can't declare global variables inside a function, the var keyword has nothing to do with var in javascript. The var keyword here is used as an alternative where the let keyword does not work.  \nvar allow you to reasign the same variable to other data types.  \nWhen using let you may need to declare a new variable.  \nYou should use let where you can, since most functions are designed to work with specific data types, where var is a unique data type holding other type inside.  \n\nRemember the purpouse of this library is not trying to implement javascript language, transpile or be a engine. It's made to program in C++, but using a short sintax and higher level approach.  \nIf you want to develop using full javascript you should go for node.js, deno, quickjs, ducktape...\n\n### Example:\n```\n#include \"./headers.h\"\n#include \u003cvector\u003e\n\nint main(int argc, char *argv[]) {\n\n  let word = \"world\";\n  console.log(\"Hello\", word, \"!\");\n\n  var a = 12;\n  console.log(\"a:\", a);\n\n  a = \"Hello!\";\n  console.log(a);\n\n  let myHtml = fetch(\"https://example.com\");\n  console.log(\"Example Code:\", myHtml);\n\n  fetchOptions.method = \"POST\";\n  fetchOptions.data = \"name=StringManolo\u0026pass=123\";\n  myHtml = fetch(\"https://example.com\");\n  console.log(\"Post Request return:\", myHtml);\n\n  let myCsv = split(\"car, bike, motorbike, truck, airplane\", \", \");\n  for(let i = 0; i \u003c myCsv.size(); ++i) {\n    console.log(\"CSV N°\", i+1 , \":\", myCsv[i]);\n  }\n\n  console.log(\"Replacing hola from hola world to hello:\",\n  replace(\"hola world!\", \"hola\", \"hello\"));\n\n  console.log(\"CSV string:\", join(myCsv, \",\"));\n\n\n  for(let vehicle in myCsv) {\n    console.log(\"Vehicle:\", vehicle);\n  }\n\n  let add = function(let num1, let num2) {\n    return num1 + num2;\n  };\n\n  console.log(\"Add 7 + 8 using function:\", add(7,8));\n\n  return 0;\n}\n```\n  \nCompile Linux:  \n```\ng++ -o program main.cpp -lcurl\n```\n  \nCompile Termux:  \n+ First Time:\n```\nmkdir ~/../usr/myPrograms \u0026\u0026 cd ~/../usr/myPrograms \u0026\u0026 git clone https://github.com/StringManolo/cppjs.git \u0026\u0026 cd cppjs\npkg install libcurl \u0026\u0026 pkg install termux-elf-cleaner \u0026\u0026 ./compile\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstringmanolo%2Fcppjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstringmanolo%2Fcppjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstringmanolo%2Fcppjs/lists"}