@codeparticle/formal
Version:
A <2kb library for validating data of any kind
1 lines • 929 B
Source Map (JSON)
{"version":3,"sources":["../src/rules/is-non-empty-object.ts"],"sourcesContent":["/**\n * @file check that an object has keys\n * @author Nick Krause\n * @license MIT\n */\nimport { createRule } from '../rule'\n\nexport const isNonEmptyObject = createRule({\n // Reflect.ownKeys is used because\n // this check should not fail if we only have\n // properties that are non-enumerable\n // like 'Symbol' or properties defined by Object.defineProperty where\n // 'enumerable' is set to false.\n condition: (obj) =>\n !!obj && typeof obj === `object` && Reflect.ownKeys(obj).length > 0,\n message: (obj) =>\n typeof obj === `object`\n ? `Object must not be empty`\n : `Value ${obj} is not an object`,\n})\n"],"mappings":";;;;;AAAA,AAOO,IAAM,mBAAmB,WAAW;AAAA,EAMzC,WAAW,CAAC,QACV,CAAC,CAAC,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,GAAG,EAAE,SAAS;AAAA,EACpE,SAAS,CAAC,QACR,OAAO,QAAQ,WACX,6BACA,SAAS;AACjB,CAAC;","names":[]}