mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
ba4c53134f
no issue - update imports for `@ember-data` package (https://github.com/emberjs/rfcs/blob/master/text/0395-ember-data-packages.md) - use `computed.reads` where applicable (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/require-computed-macros.md) - fix usage of `scheduleOnce` so that functions are only scheduled once (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-incorrect-calls-with-inline-anonymous-functions.md)
22 lines
543 B
JavaScript
22 lines
543 B
JavaScript
import Transform from '@ember-data/serializer/transform';
|
|
|
|
export default Transform.extend({
|
|
deserialize(serialized) {
|
|
if (serialized) {
|
|
let [, user] = serialized.match(/@?([^/]*)/);
|
|
|
|
return `https://twitter.com/${user}`;
|
|
}
|
|
return serialized;
|
|
},
|
|
|
|
serialize(deserialized) {
|
|
if (deserialized) {
|
|
let [, user] = deserialized.match(/(?:https:\/\/)(?:twitter\.com)\/(?:#!\/)?@?([^/]*)/);
|
|
|
|
return `@${user}`;
|
|
}
|
|
return deserialized;
|
|
}
|
|
});
|