mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
Expose existing qp serialization util as a helper
This commit is contained in:
16
ui/app/helpers/qp-deserialize.js
Normal file
16
ui/app/helpers/qp-deserialize.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import { deserialize } from 'nomad-ui/utils/qp-serialize';
|
||||
|
||||
/**
|
||||
* Query Param Serialize
|
||||
*
|
||||
* Usage: {{qp-deserialize string}}
|
||||
*
|
||||
* Turns a serialized query param value string back into
|
||||
* an array of values.
|
||||
*/
|
||||
export function qpDeserialize([str]) {
|
||||
return deserialize(str);
|
||||
}
|
||||
|
||||
export default helper(qpDeserialize);
|
||||
16
ui/app/helpers/qp-serialize.js
Normal file
16
ui/app/helpers/qp-serialize.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import { serialize } from 'nomad-ui/utils/qp-serialize';
|
||||
|
||||
/**
|
||||
* Query Param Serialize
|
||||
*
|
||||
* Usage: {{qp-serialize array}}
|
||||
*
|
||||
* Turns an array of values into a safe url encoded query param
|
||||
* value. This serialization is used throughout the app for facets.
|
||||
*/
|
||||
export function qpSerialize([values]) {
|
||||
return serialize(values);
|
||||
}
|
||||
|
||||
export default helper(qpSerialize);
|
||||
Reference in New Issue
Block a user