made with esnextbin
Last active
November 2, 2016 13:15
-
-
Save aledoroshenko/7815b693b64f1591b7bbe4d9693d20f0 to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
import expect from 'expect'; | |
const obj = [ | |
{ | |
name: 'test1', | |
colors: [ | |
{name: 'red', code: '3'}, | |
{name: 'green', code: '3'}, | |
] | |
}, | |
{ | |
name: 'test2', | |
colors: [ | |
{name: 'red', code: '3'}, | |
{name: 'green', code: '3'}, | |
] | |
}, | |
{ | |
name: 'test3', | |
colors: [ | |
{name: 'yellow', code: '3'} | |
] | |
} | |
] | |
var a = _.filter(obj, {colors: [{name: 'red'}]}); | |
console.log(a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"lodash": "4.16.4", | |
"expect": "1.20.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _lodash = require('lodash'); | |
var _lodash2 = _interopRequireDefault(_lodash); | |
var _expect = require('expect'); | |
var _expect2 = _interopRequireDefault(_expect); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var obj = [{ | |
name: 'test1', | |
colors: [{ name: 'red', code: '3' }, { name: 'green', code: '3' }] | |
}, { | |
name: 'test2', | |
colors: [{ name: 'red', code: '3' }, { name: 'green', code: '3' }] | |
}, { | |
name: 'test3', | |
colors: [{ name: 'yellow', code: '3' }] | |
}]; | |
var a = _lodash2.default.filter(obj, { colors: [{ name: 'red' }] }); | |
console.log(a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment