Skip to content

Instantly share code, notes, and snippets.

@mattkelley
Last active August 17, 2016 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattkelley/39f36b43d0dd1ec41949ac6996758201 to your computer and use it in GitHub Desktop.
Save mattkelley/39f36b43d0dd1ec41949ac6996758201 to your computer and use it in GitHub Desktop.
Sail.js demo
// @NOTE this demo assumes price is a Sail.js instance
// var price = Sail({data});
// find pricing for all sitelock products
var sitelock = price.find.product('sitelock');
// set all sitelock products to be 100 dollars
price.set(100, sitelock.matches);
// or you can operate on the return value stored on sitelock
sitelock.price(100);
// find pricing for vps product at level 1 for 12 month term and set the price to 4.25
price.find.product('vps').level('l1').term('12').price(4.25);
// omit a level filter to set all vps levels at 12 months to be 3.25
price.find.product('vps').term('24').price(3.25);
// If you want to restore all pricing to original state
price.restore();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment