Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@luxcium/object-with-expectations
Advanced tools
Let you merge objects with expected asyncronious results and normal properties.
Readme
Let you merge objects with expected asyncronious results and normal properties.
pnpm add @luxcium/object-with-expectations
import { mixBases, mixExpected } from '@luxcium/object-with-expectations';
// Objects witout an « expected » property.
const onlyFoo = {
foo: 'machin',
};
const onlyBar = {
bar: 'bidule',
};
// Objects with an « expected » property that contain
// the async values.
const foo = {
foo: 'machin',
expected: { bolo: (async () => 'await bolo')() },
};
const bar = {
bar: 'bidule',
expected: { toto: (async () => 'await toto')() },
};
expected
property.const withBaseOnly = {
...mixBases<any, any, { foo: string }, { bar: string }>(onlyFoo, onlyBar),
};
console.log('at withBaseOnly:', withBaseOnly);
// at withBaseOnly: { foo: 'machin', bar: 'bidule' }
expected
property.const withExpectedProperty = { ...mixBases(foo, bar) };
console.log('at withExpectedProperty:', withExpectedProperty);
// at withExpectedProperty: { foo: 'machin', bar: 'bidule' }
expeceted
object./**
* Testing the mixExpected keeping expected sub module
* (property/object) but discaring base properties.
* @example
* const mergeExpected: {
* expected: {
* bolo: Promise<string>;
* } & {
* toto: Promise<string>;
* };
* }
*/
const mergeExpected = mixExpected(foo, bar);
console.log('at mergeExpected:', mergeExpected);
// at mergeExpected: {
// expected: { bolo: Promise { 'await bolo' }, toto: Promise { 'await toto' } }
// }
Gradually reshaping the output type infered keeping the same value shape as expected.
/**
* Testing the mixExpected keeping expected sub module
* (property/object) but discaring base properties.
* @remarks
* Gradually reshaping the output type infered keeping the same value.
* @example
* const expected: {
* bolo: Promise<string>;
* } & {
* toto: Promise<string>;
* }
*/
const expected = mergeExpected.expected;
// or const { expected } = mergeExpected;
console.log('at expected:', expected);
// at expected: { bolo: Promise { 'await bolo' }, toto: Promise { 'await toto' } }
Giving its final shape (type wise) for the outpput
/**
* Testing the mixExpected keeping expected sub module
* (property/object) but discaring base properties.
* @remarks
* Giving its final shape (type wise) for the outpput
* @example
* const expectedResult: {
* expected: {
* bolo: Promise<string>;
* toto: Promise<string>;
* };
* }
*/
const expectedResult = { expected: { ...expected } };
console.log('at expectedResult:', expectedResult);
// at expectedResult: {
// expected: { bolo: Promise { 'await bolo' }, toto: Promise { 'await toto' } }
// }
/**
* Merging both part into a new single object
* @example
* const mergingAll: {
* expected: {
* bolo: Promise<string>;
* toto: Promise<string>;
* };
* foo: string;
* bar: string;
* }
*/
const mergingAll = { ...expectOnly, ...expectedFinal };
console.log('at mergingAll:', mergingAll);
// at mergingAll: {
// foo: 'machin',
// bar: 'bidule',
// expected: { bolo: Promise { 'await bolo' }, toto: Promise { 'await toto' } }
// }
† Scientia es lux principium✨ ™
FAQs
Let you merge objects with expected asyncronious results and normal properties.
The npm package @luxcium/object-with-expectations receives a total of 0 weekly downloads. As such, @luxcium/object-with-expectations popularity was classified as not popular.
We found that @luxcium/object-with-expectations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.