{"id":18569090,"url":"https://github.com/dainfloop/jspy","last_synced_at":"2025-11-01T15:30:32.156Z","repository":{"id":153648338,"uuid":"609624725","full_name":"DaInfLoop/jspy","owner":"DaInfLoop","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-04T18:45:09.000Z","size":12436,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-26T13:13:52.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/DaInfLoop.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":"2023-03-04T18:36:48.000Z","updated_at":"2023-03-04T18:41:06.000Z","dependencies_parsed_at":"2023-06-04T13:15:38.490Z","dependency_job_id":null,"html_url":"https://github.com/DaInfLoop/jspy","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/DaInfLoop%2Fjspy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaInfLoop%2Fjspy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaInfLoop%2Fjspy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaInfLoop%2Fjspy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DaInfLoop","download_url":"https://codeload.github.com/DaInfLoop/jspy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239301938,"owners_count":19616451,"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-11-06T22:32:14.963Z","updated_at":"2025-11-01T15:30:32.110Z","avatar_url":"https://github.com/DaInfLoop.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jspy\nThe definition of: I got bored so I decided to make Javascript in Python.\n\n## Usage:\n1) First install the library   \n2) Import it within your code:\n```py\nfrom lib import *\n# All set!\n```\n\nNote that jspy is not complete yet, so contributions on the [GitHub repo](https://github.com/DaInfLoop/jspy) are welcome!\n\n## Documentation\n\n\u003cdetails\u003e\n  \u003csummary\u003eCore\u003c/summary\u003e\n  \n### class Object\nClass you can use to create an object. This is not the recommended way to create an object, and you should use `createObject()` instead.\n\n### lib#createObject\nCreate an object from a dictionary.\n\nUsage:\n```py\nmyObj = createObject({\"hello\": \"world\"})\n```\n\n### lib#require\nImport a module/JSON file.\n\nUsage:\n```py\n# Imagine I have a file in the same directory called \"coolFile.py\"\n\ncoolFile = require('coolFile')\n```\n\n### class Console\nThe console class. This does nothing special being called manually, so just use the `console` variable.\n\n### true/false/null\nSelf-explanatory. `true == True`, `false == False`, `null == None`.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eJSON\u003c/summary\u003e\nAlready pre-imported, but you can run \u003ccode\u003erequire('jspy:json')\u003c/code\u003e to re-import.\n\n### JSON#parse -\u003e lib.core.Object\nParse a JSON object and make it into an Object.\n\nUsage:\n```py\nparsed = JSON.parse('{\"hello\":\"world\"}')\n\nconsole.log(parsed) # {\"hello\": \"world\"}\n```\n\n### JSON#stringify -\u003e str\nStringify a dict. You can specify how many spaces you want for the indent.\n\nUsage:\n```py\nmyDict = {\"hello\": \"world\"}\n\nconsole.log(JSON.stringify(myDict, null, 2))\n\"\"\"\n{\n  \"hello\": \"world\"\n}\n\"\"\"\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eEvents\u003c/summary\u003e\nImport via \u003ccode\u003erequire('jspy:events')\u003c/code\u003e.\n\n### class EventEmitter\nCreate an EventEmitter.\n\nUsage:\n```py\nemitter = EventEmitter()\n```\n\n### EventEmitter#on -\u003e null\nRegister an event.\n\nUsage:\n```py\nemitter.on('event', handler)\n```\n\n### EventEmitter#once -\u003e null\nRegister an event that will delete itself when emitted.\n\nUsage:\n```py\nemitter.once('event', handler)\n\n# After `handler` is run, the event will no longer run `handler`.\n```\n\n### @EventEmitter#event -\u003e Callable\nA decorator that you can add to a function to register it as an event.\n\nUsage:\n```py\n# emitter.on\n@emitter.event('event')\ndef onHandler(args):\n  console.log(args)\n\n# emitter.once\n@emitter.event('event', once=True)\ndef onceHandler(args):\n  console.log(args)\n```\n\n### EventEmitter#emit -\u003e bool\nEmit an event. Runs all event handlers. Returns `True` if an event handler was found, or `False` if one wasn't found.\n\nUsage:\n```py\n@emitter.event('event')\ndef onHandler(args):\n  console.log(args)\n\nemitter.emit('event', \"hello!\") # prints \"hello!\"\n```\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdainfloop%2Fjspy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdainfloop%2Fjspy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdainfloop%2Fjspy/lists"}