https://github.com/neovici/cosmoz-utils
Collection of Cosmoz base/common/helper behaviors.
https://github.com/neovici/cosmoz-utils
Last synced: 5 months ago
JSON representation
Collection of Cosmoz base/common/helper behaviors.
- Host: GitHub
- URL: https://github.com/neovici/cosmoz-utils
- Owner: Neovici
- License: apache-2.0
- Created: 2015-11-26T21:30:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-06-04T12:15:28.000Z (about 1 year ago)
- Last Synced: 2025-06-29T14:04:39.428Z (12 months ago)
- Language: TypeScript
- Homepage: https://www.webcomponents.org/element/Neovici/cosmoz-behaviors
- Size: 3.11 MB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
@neovici/cosmoz-utils
=================
[](https://github.com/Neovici/cosmoz-utils/actions?workflow=Github+CI)
[](https://saucelabs.com/u/nomego)
[](https://codeclimate.com/github/Neovici/cosmoz-utils/maintainability)
[](https://codeclimate.com/github/Neovici/cosmoz-utils/test_coverage)
[](https://github.com/semantic-release/semantic-release)
## Cosmoz Utils
**cosmoz-utils** contains date, money and template management functions commonly
needed in page views. This package does not contain any visual element.
## Upgrade guide
Upgrading from `cosmoz-behaviors` is very straightforward.
* `Cosmoz.TemplateHelperBehavior` -> `import { Template } from '@neovici/cosmoz-utils'`
* `Cosmoz.MoneyHelperBehavior` -> `import { Money } from '@neovici/cosmoz-utils'`
* `Cosmoz.DateHelperBehavior` -> `import { Date } from '@neovici/cosmoz-utils'`
* `Polymer.mixinBehaviors([Cosmoz.TemplateHelperBehavior], Polymer.Element)` -> `mixin(Template, PolymerElement)`
* `Polymer.mixinBehaviors([Cosmoz.TemplateHelperBehavior, Cosmoz.MoneyHelperBehavior], Polymer.Element)` -> `mixin({...Template, ...Money}, PolymerElement)`
This code:
```js
class DemoTemplateHelper extends Polymer.mixinBehaviors([Cosmoz.TemplateHelperBehavior], Polymer.Element) {
```
Becomes:
```js
import { PolymerElement } from '@polymer/polymer/polymer-element';
import { mixin, Template } from '@neovici/cosmoz-utils';
class DemoTemplateHelper extends mixin(Template, PolymerElement) {
```
You can also pick and choose only the functions your element needs:
```js
import { mixin, Money } from '@neovici/cosmoz-utils';
import { isEmpty } from '@neovici/cosmoz-utils/template';
import { isoDate } from '@neovici/cosmoz-utils/date';
class DemoMoneyHelper extends mixin({isEmpty, isoDate, ...Money}, PolymerElement) {
```
### Big Thanks
Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce_homepage]
[](https://saucelabs.com/u/nomego)
[sauce_homepage]: https://saucelabs.com