JSFiddle - React, Tailwind, and code Playground

Finding value from property with newline in it

by larsolesimonsen

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>

JavaScript

var foo = { 'line1\nline2': 'this is what we want', normalProp: 'other value' };

var newlinePropName = _.first(_.keys(foo).filter(function(p) { return /\n/.test(p); }));

document.body.innerHTML = foo[newlinePropName];