UNPKG

@wordpress/core-data

Version:
8 lines (7 loc) 687 B
{ "version": 3, "sources": ["../../src/hooks/use-entity-id.js"], "sourcesContent": ["import { useContext } from '@wordpress/element';\nimport { EntityContext } from '../entity-context';\n\n/**\n * Hook that returns the ID for the nearest\n * provided entity of the specified type.\n *\n * @param {string} kind The entity kind.\n * @param {string} name The entity name.\n */\nexport default function useEntityId( kind, name ) {\n\tconst context = useContext( EntityContext );\n\treturn context?.[ kind ]?.[ name ];\n}\n"], "mappings": ";AAAA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AASf,SAAR,YAA8B,MAAM,MAAO;AACjD,QAAM,UAAU,WAAY,aAAc;AAC1C,SAAO,UAAW,IAAK,IAAK,IAAK;AAClC;", "names": [] }