nl_tokens: Convert custom post metadata array to product attributes
pl_tokens: function customPostMetadataToProductAttributes ( metadata ) { const productAttributes = { } ; metadata . forEach ( ( { key , value } ) => { const schemaKey = metaKeyToSchemaKeyMap [ key ] ; if ( ! schemaKey ) { return ; } // If the property's type is marked as boolean in the schema, // convert the value from PHP-ish truthy/falsy numbers to a plain boolean. // Strings "0" and "" are converted to false, "1" is converted to true. if ( metadataSchema [ schemaKey ] . <mask> === 'boolean' ) { value = ! ! Number ( value ) ; } productAttributes [ schemaKey ] = value ; } ) ; return productAttributes ; }