Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jesstelford/fe-html-model-decoder
Decode model data as encoded in a page's HTML
https://github.com/jesstelford/fe-html-model-decoder
Last synced: about 1 month ago
JSON representation
Decode model data as encoded in a page's HTML
- Host: GitHub
- URL: https://github.com/jesstelford/fe-html-model-decoder
- Owner: jesstelford
- Created: 2016-01-28T21:01:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-28T21:44:46.000Z (almost 9 years ago)
- Last Synced: 2024-06-11T17:36:44.770Z (7 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTML Model Decoder
## Example
```html
{"foo":"bar","zip":[1,2,3]}
``````javascript
var htmlModeDecoder = require('@domain-group/fe-html-model-decoder');var decoded = htmlModeDecoder(document.getElementById('model'));
// {foo: 'bar', zip: [1, 2, 3]}
```## Usage
**`function(DOMNode node)`**
A single function is exported, which expects a DOMNode as its first and only
parameter. This DOMNode should contain some HTML Encoded JSON to be decoded and
returned.## Credit
Modified from [IdentityServer3](https://github.com/IdentityServer/IdentityServer3/blob/a6e2b6bdfd1516af6cd9fdc9f46a08bb23bb553e/source/Core/Services/DefaultViewService/HttpAssets/app/app.js#L12-L23)