### Initializing ObjectPath with GitHub Payload in JavaScript Source: https://github.com/adriank/objectpath.js/blob/master/README.md This snippet initializes the ObjectPath library by passing the previously defined GitHubPayload object. This creates an ObjectPath instance (op) that can be used to execute queries against the payload. ```javascript var op=ObjectPath(GitHubPayload) ``` -------------------------------- ### Defining GitHub Payload Object in JavaScript Source: https://github.com/adriank/objectpath.js/blob/master/README.md This snippet defines a sample GitHub webhook payload as a JavaScript object, which serves as the data source for ObjectPath queries. It includes detailed information about the repository, commits, and author details. ```javascript var GitHubPayload={ "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d", "repository": { "url": "http://github.com/defunkt/github", "name": "github", "description": "You're lookin' at it.", "watchers": 5, "forks": 2, "private": 1, "owner": { "email": "chris@ozmm.org", "name": "defunkt" } }, "commits": [ { "id": "41a212ee83ca127e3c8cf465891ab7216a705f59", "url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59", "author": { "email": "chris@ozmm.org", "name": "Chris Wanstrath" }, "message": "okay i give in", "timestamp": "2008-02-15T14:57:17-08:00", "added": ["filepath.rb"] }, { "id": "de8251ff97ee194a289832576287d6f8ad74e3d0", "url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0", "author": { "email": "chris@ozmm.org", "name": "Chris Wanstrath" }, "message": "update pricing a tad", "timestamp": "2008-02-15T14:36:34-08:00" } ], "after": "de8251ff97ee194a289832576287d6f8ad74e3d0", "ref": "refs/heads/master" } ``` -------------------------------- ### Querying Commits with Added Files in JavaScript Source: https://github.com/adriank/objectpath.js/blob/master/README.md This snippet demonstrates how to find commits that have added files. It uses the `$.commits[@.added is not null]` expression to filter commits where the 'added' property is not null, indicating files were added. ```javascript //commits that added some files console.log(op.execute("$.commits[@.added is not null]") ``` -------------------------------- ### Querying Commits by Specific Author in JavaScript Source: https://github.com/adriank/objectpath.js/blob/master/README.md This snippet demonstrates how to use ObjectPath to find all commits made by 'Chris Wanstrath' within the GitHub payload. It uses the `$.commits[@.author.name is 'Chris Wanstrath']` expression to filter commits based on the author's name. ```javascript //find all commits by Chris Wanstrath console.log(op.execute("$.commits[@.author.name is 'Chris Wanstrath']") ``` -------------------------------- ### Extracting All Email Addresses in JavaScript Source: https://github.com/adriank/objectpath.js/blob/master/README.md This snippet uses ObjectPath to extract all email addresses found anywhere within the GitHub payload. The `$` operator is used for a recursive descent search to find all 'email' properties. ```javascript //all mails in one list console.log(op.execute("$..email") ``` -------------------------------- ### Deep Scanning for Author Occurrences in JavaScript Source: https://github.com/adriank/objectpath.js/blob/master/README.md This snippet shows a deep scan using ObjectPath to find all elements anywhere in the object where the author's name is 'Chris Wanstrath'. The `$` operator performs a recursive descent search. ```javascript console.log(op.execute("$..*[@.author.name is 'Chris Wanstrath']") ``` -------------------------------- ### Setting Body Background Color in CSS Source: https://github.com/adriank/objectpath.js/blob/master/index.html This CSS snippet applies a black background to the HTML body element. This is a common styling technique used to establish a base background color for a webpage, often for dark themes or specific visual designs. ```CSS body{background: black;} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.