<commit_before># Shop.js  [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url]  [![Gitter chat][gitter-image]][gitter-url]
Shopping framework for JavaScript.

[crowdstart]: https://crowdstart.com
[shop.js]: https://cdn.rawgit.com/crowdstart/shop.js/v0.0.1/shop.min.js
[travis-url]: https://travis-ci.org/crowdstart/shop.js
[travis-image]: https://img.shields.io/travis/crowdstart/shop.js.svg
[coveralls-url]: https://coveralls.io/r/crowdstart/shop.js/
[coveralls-image]: https://img.shields.io/coveralls/crowdstart/shop.js.svg
[npm-url]: https://www.npmjs.com/package/shop.js
[npm-image]: https://img.shields.io/npm/v/shop.js.svg
[downloads-image]: https://img.shields.io/npm/dm/shop.js.svg
[downloads-url]: http://badge.fury.io/js/shop.js
[gitter-url]: https://gitter.im/crowdstart/chat
[gitter-image]: https://img.shields.io/badge/gitter-join_chat-brightgreen.svg

---
##Containers and Controls##
Containers are Custom HTML tags that define a section of dynamic content.
Controls are very simple composeable widgets that provide ui inputs and outputs
for users.  Containers can contain other containers or controls.

## Special Variables ##

### data ###
A reference to the global data [referrential tree](https://github.com/zeekay/referential)
that's passed into the Shop.start function can be referenced from most
containers by using the 'data' variable.

The exceptions to this rule are lineitem and order which are used internally by
the looping containers lineitems and orders respectively.  The 'data' in these containers refer
to the specific item that's currently being looped over.  For example a lineitems container loops over order.items, a lineitem container's
'data' variable refers to the specific item being looped over.

### parent-data ###

Both lineitem and order both have a 'parent-data' variable that refer to their
immediate parents's for composeability reasons, namely to get fields like
'currency' relatively the parent order for rendering items.

### parent ###
The 'parent' variable references the parent container of the current container.
It is useful for using data fields or invoking services of a parent container.
Be aware that the root container has no parent set.

###### All Containers Read-Only Data Fields ######
Read-only data fields should not be modified.

| Field | Type | Notes |
| --- | --- | --- |
| order.currency | string | 3 character ISO 4217 code |

###### All Containers Services ######

| Service | Signature | Description |
| --- | --- | --- |
| renderCurrency | (code&nbsp;string,&nbsp;cents&nbsp;number)&nbsp;&#8209;>&nbsp;string |  **code** is a currency's ISO 4217 code, **cents** is the currency in cents (or lowest unit in the case of zero decimal currencies like JPY), returns a localized value with currency symbol |
| renderDate | (date time,&nbsp;format string)&nbsp;&#8209;>&nbsp;string | refer to moment(...).format(...) documentation [here](http://momentjs.com/docs/#/parsing/string-format/)

### cart ###
The cart container renders cart items and handles the processing of promotional codes.

###### Data Fields ######
| Field | Type | Notes |
| --- | --- | --- |
| order.promoCode | string | promotional code (coupon) |

###### Read-only Data Fields ######
| Field | Type | Notes |
| --- | --- | --- |
| promoMessage | string | current status of the promotional code |
| applying | string | true when applyPromoCode is processing, false otherwise |

###### Services ######<commit_msg>readability fixes<commit_after># Shop.js  [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url]  [![Gitter chat][gitter-image]][gitter-url]
Shopping framework for JavaScript.

[crowdstart]: https://crowdstart.com
[shop.js]: https://cdn.rawgit.com/crowdstart/shop.js/v0.0.1/shop.min.js
[travis-url]: https://travis-ci.org/crowdstart/shop.js
[travis-image]: https://img.shields.io/travis/crowdstart/shop.js.svg
[coveralls-url]: https://coveralls.io/r/crowdstart/shop.js/
[coveralls-image]: https://img.shields.io/coveralls/crowdstart/shop.js.svg
[npm-url]: https://www.npmjs.com/package/shop.js
[npm-image]: https://img.shields.io/npm/v/shop.js.svg
[downloads-image]: https://img.shields.io/npm/dm/shop.js.svg
[downloads-url]: http://badge.fury.io/js/shop.js
[gitter-url]: https://gitter.im/crowdstart/chat
[gitter-image]: https://img.shields.io/badge/gitter-join_chat-brightgreen.svg

---
##Containers and Controls##
Containers are Custom HTML tags that define a section of dynamic content.
Controls are very simple composeable widgets that provide ui inputs and outputs
for users.  Containers can contain other containers or controls.

## Special Variables ##

### data ###
A reference to the global data [referrential tree](https://github.com/zeekay/referential)
that's passed into the Shop.start function can be referenced from most
containers by using the 'data' variable.

The exceptions to this rule are lineitem and order which are used internally by
the looping containers lineitems and orders respectively.  The 'data' in these containers refer
to the specific item that's currently being looped over.  For example a lineitems container loops over order.items, a lineitem container's
'data' variable refers to the specific item being looped over.

### parent-data ###

Both lineitem and order both have a 'parent-data' variable that refer to their
immediate parents's for composeability reasons, namely to get fields like
'currency' relatively from the parent order or user.

### parent ###
The 'parent' variable references the parent container of the current container.
It is useful for using data fields or invoking services of a parent container.
Be aware that the root container has no parent set.

## All Containers Read-Only Data Fields ##
Read-only data fields should not be modified.

| Field | Type | Notes |
| --- | --- | --- |
| order.currency | string | 3 character ISO 4217 code |

## All Containers Services ##

| Service | Signature | Description |
| --- | --- | --- |
| renderCurrency | (code&nbsp;string,&nbsp;cents&nbsp;number)&nbsp;&#8209;>&nbsp;string |  **code** is a currency's ISO 4217 code, **cents** is the currency in cents (or lowest unit in the case of zero decimal currencies like JPY), returns a localized value with currency symbol |
| renderDate | (date time,&nbsp;format string)&nbsp;&#8209;>&nbsp;string | refer to moment(...).format(...) documentation [here](http://momentjs.com/docs/#/parsing/string-format/)

---
##Containers##

### cart ###
The cart container renders cart items and handles the processing of promotional codes.

###### Data Fields ######
| Field | Type | Notes |
| --- | --- | --- |
| order.promoCode | string | promotional code (coupon) |

###### Read-only Data Fields ######
| Field | Type | Notes |
| --- | --- | --- |
| promoMessage | string | current status of the promotional code |
| applying | string | true when applyPromoCode is processing, false otherwise |

###### Services ######
{'fraction_non_alphanumeric': 0.1435846654406564, 'fraction_numerical': 0.005658508982883011, 'mean_word_length': 4.380517503805175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 24, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4165218', 'n_tokens_mistral': 2164, 'n_tokens_neox': 2062, 'n_words': 694}