Skip to content

Instantly share code, notes, and snippets.

@bfitch
Created February 17, 2016 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfitch/6353574361776965ec2e to your computer and use it in GitHub Desktop.
Save bfitch/6353574361776965ec2e to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<div id="app"></div>
</body>
</html>
import _ from 'lodash';
function toCerebralPath(query) {
return _.reject(
query.split(/\[|\]|'/g),
path => _.isEmpty(path) || path === ',')
}
console.log(toCerebralPath("userLoggedIn['credits_balance','usd_balance']"))
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"lodash": "4.0.0"
}
}
'use strict';
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toCerebralPath(query) {
return _lodash2.default.reject(query.split(/\[|\]|'/g), function (path) {
return _lodash2.default.isEmpty(path) || path === ',';
});
}
console.log(toCerebralPath("userLoggedIn['credits_balance','usd_balance']"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment