Socket
Socket
Sign inDemoInstall

@tamagui/use-constant

Package Overview
Dependencies
Maintainers
0
Versions
845
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tamagui/use-constant - npm Package Compare versions

Comparing version 1.107.0 to 1.108.0-1722728147390

18

dist/cjs/index.js

@@ -0,5 +1,6 @@

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {

@@ -14,3 +15,10 @@ for (var name in all)

};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
mod
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var src_exports = {};

@@ -21,9 +29,9 @@ __export(src_exports, {

module.exports = __toCommonJS(src_exports);
var import_react = require("react");
var React = __toESM(require("react"));
function useConstant(fn) {
if (typeof document > "u")
return (0, import_react.useMemo)(() => fn(), []);
const ref = (0, import_react.useRef)();
return React.useMemo(() => fn(), []);
const ref = React.useRef();
return ref.current || (ref.current = { v: fn() }), ref.current.v;
}
//# sourceMappingURL=index.js.map
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {

@@ -15,3 +16,10 @@ for (var name in all)

};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
mod
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var src_exports = {};

@@ -22,9 +30,9 @@ __export(src_exports, {

module.exports = __toCommonJS(src_exports);
var import_react = require("react");
var React = __toESM(require("react"));
function useConstant(fn) {
if (typeof document > "u")
return (0, import_react.useMemo)(function() {
return React.useMemo(function() {
return fn();
}, []);
var ref = (0, import_react.useRef)();
var ref = React.useRef();
return ref.current || (ref.current = {

@@ -31,0 +39,0 @@ v: fn()

@@ -1,6 +0,6 @@

import { useMemo, useRef } from "react";
import * as React from "react";
function useConstant(fn) {
if (typeof document > "u")
return useMemo(() => fn(), []);
const ref = useRef();
return React.useMemo(() => fn(), []);
const ref = React.useRef();
return ref.current || (ref.current = { v: fn() }), ref.current.v;

@@ -7,0 +7,0 @@ }

@@ -1,8 +0,8 @@

import { useMemo, useRef } from "react";
import * as React from "react";
function useConstant(fn) {
if (typeof document > "u")
return useMemo(function() {
return React.useMemo(function() {
return fn();
}, []);
var ref = useRef();
var ref = React.useRef();
return ref.current || (ref.current = {

@@ -9,0 +9,0 @@ v: fn()

{
"name": "@tamagui/use-constant",
"version": "1.107.0",
"version": "1.108.0-1722728147390",
"types": "./types/index.d.ts",

@@ -30,3 +30,3 @@ "main": "dist/cjs",

"devDependencies": {
"@tamagui/build": "1.107.0",
"@tamagui/build": "1.108.0-1722728147390",
"react": "^18.2.0 || ^19.0.0"

@@ -33,0 +33,0 @@ },

@@ -1,2 +0,2 @@

import { useMemo, useRef } from 'react'
import * as React from 'react'

@@ -8,6 +8,6 @@ type ResultBox<T> = { v: T }

if (typeof document === 'undefined') {
return useMemo(() => fn(), [])
return React.useMemo(() => fn(), [])
}
const ref = useRef<ResultBox<T>>()
const ref = React.useRef<ResultBox<T>>()

@@ -14,0 +14,0 @@ if (!ref.current) {

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

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