Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 

lit-element-serializers

A selection of common attribute serializers for use with LitElement.

These allow simple (de)serialization around common data structures such as objects, dates, strings and so on.

Install

Simple:

$ npm i -S lit-element-serializers

Usage

To use these:

import { NullableStringSerializer } from 'lit-element-serializers';

class MyElement extends LitElement {
  @property({ type: NullableStringSerializer })
  foo = 'test';
}

Serializers

NullableStringSerializer

The nullable string serializer allows easy serialization between string values and null or the given value, meaning falsy strings will be treated and set on your element as null.

ObjectSerializer

Simply a wrapper around JSON.parse and JSON.stringify, so any value passed to the property using this serializer will attempt to parse or output JSON.

This behaves similar to how type: Object did in Polymer.

About

Common attribute serializers for lit-element

Resources

Releases

No releases published

Packages

No packages published