You would probably want to do stuff because:
- Stuff is fun
- Stuff is good
| <div id="ProductSection" data-section-id="{{ section.id }}" data-section-type="product-template" data-zoom-toggle="zoom-in" data-zoom-enabled="{{ section.settings.product_image_zoom_enable }}" data-related-enabled="{{ section.settings.product_related_enable }}" data-social-sharing="{{ section.settings.social_sharing }}" data-show-compare-at-price="{{ section.settings.product_show_compare_at_price }}" data-stock="{{ section.settings.product_quantity_message }}" data-incoming-transfer="{{ section.settings.product_incoming_message }}"> | |
| {% include 'breadcrumb' %} | |
| <div class="grid" itemscope itemtype="http://schema.org/Product"> | |
| <meta itemprop="url" content="{{ shop.url }}{{ product.url }}"> | |
| <meta itemprop="image" content="{{ product.featured_image.src | img_url: 'grande' }}"> | |
| <div class="grid-item large--two-fifths"> | |
| <div class="grid"> | |
| <div class="grid-item large--eleven-twelfths text-center"> |
| {% assign saved_amount = compare_price | minus: product_price %} | |
| {% comment %} | |
| Unless this store uses multiple currencies, | |
| we will remove the decimals when they are equal to 00, | |
| or when the amount is > 10 (dollars, pounds, etc.). | |
| {% endcomment %} | |
| <!-- using expected price-sale template --> |
| const dfsGenerator = function*( node ){ | |
| const nodes = [ node ] | |
| while( nodes.length > 0 ){ | |
| const current = nodes.pop() | |
| yield current | |
| let child = current.lastChild |
| const dfsIterator = node => { | |
| const nodes = [ node ] | |
| const next = () => { | |
| const done = nodes.length === 0 | |
| if( done ) return { done } | |
| const value = nodes.pop() | |
| let child = value.lastChild |
| const flatten = array => { | |
| const result = [] | |
| const nodes = array.slice() | |
| let node | |
| while( nodes.length > 0 ){ | |
| node = nodes.pop() | |
| if( Array.isArray( node ) ){ | |
| nodes.push( ...node ) |
| interface Predicate<T> { | |
| ( subject:T ): boolean | |
| } | |
| interface DomAdapter<TNode, TElementNode> { | |
| // is the node a tag? | |
| isTag: Predicate<TNode>, | |
| // does at least one of passed nodes pass the test? | |
| existsOne: ( test:Predicate<TElementNode>, nodes:[TNode] ) => boolean, |
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Launch", | |
| "type": "node", | |
| "request": "launch", | |
| "program": "${workspaceRoot}/index.js", | |
| "stopOnEntry": false, | |
| "args": [], |
| const isPrimitive = obj => | |
| obj === null || | |
| [ 'string', 'number', 'boolean' ].includes( typeof obj ) | |
| const isArrayOfPrimitive = obj => | |
| Array.isArray( obj ) && obj.every( isPrimitive ) | |
| const format = arr => | |
| `^^^[ ${ | |
| arr.map( val => JSON.stringify( val ) ).join( ', ' ) |
| const template = data => | |
| `<p> | |
| Use the <strong>${ data.power }</strong>, ${ data.name }! | |
| </p>` | |
| document.getElementById( 'target' ).innerHTML = template( {name: "Luke", power: "force"} ) |