New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

awai

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awai - npm Package Compare versions

Comparing version 0.0.1-alpha-15 to 0.0.1-alpha-16

28

dist/index.js

@@ -109,16 +109,3 @@ 'use strict';

let error = null;
let isLoading = false;
let value = isInitialValueAsync ? void 0 : initialValue;
if (isInitialValueAsync) {
status = AsyncStatus.LOADING;
const initialValuePromise = isFunction(initialValue) ? initialValue() : initialValue;
Promise.resolve(initialValuePromise).then((resolvedValue) => {
if (version === 0) {
value = resolvedValue;
version = 1;
status = AsyncStatus.LOADED;
events.changed.emit(resolvedValue);
}
});
}
const events = {

@@ -131,3 +118,3 @@ changed: new AwaitableEvent(),

const set = async (nextValueOrResolver) => {
const nextVersion = ++version % Number.MAX_SAFE_INTEGER;
const lastVersion = version;
try {

@@ -139,3 +126,3 @@ if (isPromiseOrFunction(nextValueOrResolver)) {

let newValue = isFunction(nextValueOrResolver) ? await nextValueOrResolver(value) : await nextValueOrResolver;
if (version !== nextVersion) {
if (lastVersion !== version) {
return;

@@ -153,6 +140,11 @@ }

}
version++;
await flush();
};
const get = () => value;
const getAsync = () => ({ error, isLoading, value });
const getAsync = () => ({
error,
isLoading: status === AsyncStatus.LOADING,
value
});
const getPromise = async () => {

@@ -168,2 +160,6 @@ if (version > 0) {

};
if (isInitialValueAsync) {
const initialValuePromise = isFunction(initialValue) ? initialValue() : initialValue;
set(initialValuePromise);
}
return {

@@ -170,0 +166,0 @@ events,

{
"name": "awai",
"version": "0.0.1-alpha-15",
"version": "0.0.1-alpha-16",
"author": "Yuriy Yakym",

@@ -5,0 +5,0 @@ "description": "State management library",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc