{"id":18429458,"url":"https://github.com/bigpipe/parsifal","last_synced_at":"2025-04-13T21:44:42.281Z","repository":{"id":16260456,"uuid":"19008552","full_name":"bigpipe/parsifal","owner":"bigpipe","description":"Parse element values","archived":false,"fork":false,"pushed_at":"2016-11-16T20:44:58.000Z","size":8,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-17T02:37:45.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigpipe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-21T22:04:57.000Z","updated_at":"2018-04-11T07:17:32.000Z","dependencies_parsed_at":"2022-07-25T03:47:07.723Z","dependency_job_id":null,"html_url":"https://github.com/bigpipe/parsifal","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/bigpipe%2Fparsifal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Fparsifal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Fparsifal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpipe%2Fparsifal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigpipe","download_url":"https://codeload.github.com/bigpipe/parsifal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788869,"owners_count":21161726,"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-06T05:17:17.130Z","updated_at":"2025-04-13T21:44:42.252Z","avatar_url":"https://github.com/bigpipe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parsifal\n\nParsifal is a pure JavaScript port of jQuery's `.val()` method which is used to\nretrieve values from from elements.\n\n## Installation\n\nThe package can be used through browserify as the module contents are exposes\nthrough the `module.exports` interface. Therefor this package is installable\nusing npm:\n\n```\nnpm install --save parsifal\n```\n\n## Usage\n\nThis module exposes the parser as a single function. To use it in your library\nsimple require the module:\n\n```js\n'use strict';\n\nvar val = require('parsifal');\n```\n\nNow that we have access to the method, we can simply start parsing the value's\nout of elements:\n\n```js\nvar value = val(document.getElementByTagName('input')[0]);\n```\n\nAnd that's it. Super simple, super effective.\n\n### parsifal.parser\n\nWe expose dedicated parsers for elements based on their `type` or `nodeName`. If\nyou wish to add more or change a parser simply add or override the property\nwith a new method. Check the source for the current dedicated parsers.\n\n```js\n//\n// EXAMPLE: Simple override or introduction of the radio button parser so it\n// returns booleans instead of strings.\n//\nparsifal.parser.radio = function radio(element) {\n  return ((element.getAttribute('value') !== null ? element.value : 'on') === 'on';\n};\n```\n\n---\n\nThe following methods are mostly internally but are to useful for other to not\nexpose them.\n\n### parsifal.trim()\n\n```js\nparsifal.trim(string)\n```\n\nTrim the whitespace of a string from the right and left side.\n\n```js\nvar str = parsifal.trim('  fooo   ');\n// str is now 'foo'\n```\n\n### parsifal.text()\n\n```js\nparsifal.text(element)\n```\n\nGet the text from a given element without all the nasty HTML.\n\n```js\nvar text = parsifal.text(document.getElementById('example'));\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpipe%2Fparsifal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigpipe%2Fparsifal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpipe%2Fparsifal/lists"}