Skip to content
module@warp-drive/legacy/serializer/transform @legacy

Class StringTransform ​

Defined in: warp-drive-packages/legacy/src/serializer/-private/transforms/string.ts:6

The StringTransform class is used to serialize and deserialize string attributes on Ember Data record objects. This transform is used when string is passed as the type parameter to the attr function.

Usage

app/models/user.js
js
import Model, { attr, belongsTo } from '@warp-drive/legacy/model';

export default class UserModel extends Model {
  @attr('boolean') isAdmin;
  @attr('string') name;
  @attr('string') email;
}

Constructors ​

Constructor ​

ts
new StringTransform(): StringTransform;

Returns ​

StringTransform

Methods ​

deserialize() ​

ts
deserialize(serialized, _options?): string | null;

Defined in: warp-drive-packages/legacy/src/serializer/-private/transforms/string.ts:37

Converts a serialized (raw payload) value into a string, or null if the value is falsy (and not an empty string).

Parameters ​

serialized ​

unknown

_options? ​

Record<string, unknown>

Returns ​

string | null


serialize() ​

ts
serialize(deserialized, _options?): string | null;

Defined in: warp-drive-packages/legacy/src/serializer/-private/transforms/string.ts:43

Converts a string attribute value into its serialized (raw payload) form.

Parameters ​

deserialized ​

unknown

_options? ​

Record<string, unknown>

Returns ​

string | null


create() ​

ts
static create(): StringTransform;

Defined in: warp-drive-packages/legacy/src/serializer/-private/transforms/string.ts:50

Creates a new instance of this transform.

Returns ​

StringTransform

Properties ​

___(unique) Symbol($type) ​

ts
___(unique) Symbol($type): "string";

Defined in: warp-drive-packages/legacy/src/serializer/-private/transforms/string.ts:10

see TransformName

Released under the MIT License.