UNPKG

@wordpress/core-data

Version:
8 lines (7 loc) 798 B
{ "version": 3, "sources": ["../../src/hooks/use-entity-id.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\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;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA2B;AAK3B,4BAA8B;AASf,SAAR,YAA8B,MAAM,MAAO;AACjD,QAAM,cAAU,2BAAY,mCAAc;AAC1C,SAAO,UAAW,IAAK,IAAK,IAAK;AAClC;", "names": [] }