Expose existing qp serialization util as a helper
This commit is contained in:
parent
e611b6fcb9
commit
98933e12a0
|
@ -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);
|
|
@ -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);
|
Loading…
Reference in New Issue