Skip to content

Commit

Permalink
streamline formating
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzofox3 committed Oct 26, 2024
1 parent d13df64 commit 7f40ab8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const mapValues = (mapFn) => (source) =>
[
...Object.getOwnPropertyNames(source),
...Object.getOwnPropertySymbols(source),
].map((key) => [key, mapFn(source[key], key)])
].map((key) => [key, mapFn(source[key], key)]),
);

export const valueFn = (val) => () => val;
Expand Down Expand Up @@ -31,7 +31,7 @@ export const createProvider = ({ injectables, api = [] }) => {
provide({
...externalDeps,
...subArgs,
})
}),
),
...externalDeps,
},
Expand All @@ -40,13 +40,13 @@ export const createProvider = ({ injectables, api = [] }) => {
if (!(prop in target)) {
throw new Error(
`could not resolve injectable with injection token "${String(
prop
)}"`
prop,
)}"`,
);
}
return Reflect.get(target, prop, receiver);
},
}
},
);

const mapWithPropertyDescriptor = mapValues((factory, key) => {
Expand All @@ -61,6 +61,7 @@ export const createProvider = ({ injectables, api = [] }) => {
});

const properties = mapWithPropertyDescriptor(_injectables);

return Object.defineProperties(_injectables, properties);
};
};

0 comments on commit 7f40ab8

Please sign in to comment.