File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 77 }
88 },
99 "plugins" : [
10+ " macros" ,
1011 " @babel/transform-flow-strip-types"
1112 ],
1213 "presets" : [
Original file line number Diff line number Diff line change 2020 },
2121 "bin" : " ./dist/bin/index.js" ,
2222 "dependencies" : {
23+ "babel-plugin-macros" : " ^2.6.1" ,
2324 "es6-error" : " ^4.1.1" ,
25+ "inline-loops.macro" : " ^1.0.3" ,
2426 "lodash" : " ^4.17.11" ,
2527 "pluralize" : " ^8.0.0" ,
2628 "roarr" : " ^2.13.2" ,
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ import {
66import {
77 camelCase
88} from 'lodash' ;
9+ import {
10+ filter ,
11+ find
12+ } from 'inline-loops.macro' ;
913import Logger from '../Logger' ;
1014import {
1115 NotFoundError
@@ -44,15 +48,15 @@ export default async (
4448
4549 if ( resultIsArray ) {
4650 for ( const id of ids ) {
47- const result = rows . filter ( ( row ) => {
51+ const result = filter ( rows , ( row ) => {
4852 return row [ targetPropertyName ] === id ;
4953 } ) ;
5054
5155 results . push ( result ) ;
5256 }
5357 } else {
5458 for ( const id of ids ) {
55- let result = rows . find ( ( row ) => {
59+ let result = find ( rows , ( row ) => {
5660 return row [ targetPropertyName ] === id ;
5761 } ) ;
5862
Original file line number Diff line number Diff line change 33import {
44 sql
55} from 'slonik' ;
6+ import {
7+ filter
8+ } from 'inline-loops.macro' ;
69import type {
710 DatabaseConnectionType
811} from '../types' ;
@@ -32,7 +35,7 @@ export default async (
3235 const results = [ ] ;
3336
3437 for ( const id of ids ) {
35- const result = rows . filter ( ( row ) => {
38+ const result = filter ( rows , ( row ) => {
3639 return row . POSTLOADER_LOOKUP_KEY === id ;
3740 } ) ;
3841
You can’t perform that action at this time.
0 commit comments