Add new has operator for searching

This commit is contained in:
John R. Supplee 2021-02-21 01:41:58 +02:00
parent c02b71e0e1
commit 726be664c8
4 changed files with 43 additions and 2 deletions

View file

@ -134,7 +134,10 @@ SessionData.helpers({
SessionData.unpickle = pickle => {
return JSON.parse(pickle, (key, value) => {
if (typeof value === 'object') {
if (value === null) {
return null;
} else if (typeof value === 'object') {
// eslint-disable-next-line no-prototype-builtins
if (value.hasOwnProperty('$$class')) {
if (value.$$class === 'RegExp') {
return new RegExp(value.source, value.flags);
@ -147,7 +150,9 @@ SessionData.unpickle = pickle => {
SessionData.pickle = value => {
return JSON.stringify(value, (key, value) => {
if (typeof value === 'object') {
if (value === null) {
return null;
} else if (typeof value === 'object') {
if (value.constructor.name === 'RegExp') {
return {
$$class: 'RegExp',