import { NestedKeys, NestedValue, PlainObject, ToString } from "../../models.mjs"; import { Result } from "../../result/models.mjs"; //#region src/internal/value/has.d.ts /** * Check if a property is defined in an object * * @param data Object to check in * @param path Path for property, e.g., `foo.bar.baz` * @returns `true` if the property exists, `false` otherwise * * @example * ```typescript * const data = {foo: {bar: {baz: 42}}}; * * hasValue(data, 'foo'); // => true * hasValue(data, 'foo.bar'); // => true * hasValue(data, 'foo.bar.baz'); // => true * hasValue(data, 'foo.nope'); // => false * ``` */ declare function hasValue>(data: Data, path: Path): boolean; /** * Check if a property is defined in an object * * @param data Object to check in * @param path Path for property, e.g., `foo.bar.baz` * @param ignoreCase If `true`, the path matching is case-insensitive * @returns `true` if the property exists, `false` otherwise * * @example * ```typescript * const data = {foo: {bar: {baz: 42}}}; * * hasValue(data, 'foo'); // => true * hasValue(data, 'foo.bar'); // => true * hasValue(data, 'Foo.Bar.Baz', true); // => true * hasValue(data, 'foo.nope'); // => false * ``` */ declare function hasValue(data: Data, path: string, ignoreCase?: boolean): boolean; declare namespace hasValue { var get: typeof hasValueResult; } /** * Check if a property is defined in an object, and get its value if it is * * _Available as `hasValueResult` and `hasValue.get`_ * * @param data Object to check in * @param path Path for property, e.g., `foo.bar.baz` * @param ignoreCase If `true`, the path matching is case-insensitive * @returns Result object * * @example * ```typescript * const data = {foo: {bar: {baz: 42}}}; * * hasValueResult(data, 'foo'); // => {ok: true, value: {bar: {baz: 42}}} * hasValueResult(data, 'foo.bar'); // => {ok: true, value: {baz: 42}} * hasValueResult(data, 'foo.bar.baz'); // => {ok: true, value: 42} * hasValueResult(data, 'foo.nope'); // => {ok: false, error: 'Expected property to exist in object'} * ``` */ declare function hasValueResult>(data: Data, path: Path): Result>, string>; /** * Check if a property is defined in an object, and get its value if it is * * _Available as `hasValueResult` and `hasValue.get`_ * * @param data Object to check in * @param path Path for property, e.g., `foo.bar.baz` * @param ignoreCase If `true`, the path matching is case-insensitive * @returns Result object * * @example * ```typescript * const data = {foo: {bar: {baz: 42}}}; * * hasValueResult(data, 'foo'); // => {ok: true, value: {bar: {baz: 42}}} * hasValueResult(data, 'foo.bar'); // => {ok: true, value: {baz: 42}} * hasValueResult(data, 'Foo.Bar.Baz', true); // => {ok: true, value: 42} * hasValueResult(data, 'foo.nope'); // => {ok: false, error: 'Expected property to exist in object'} * ``` */ declare function hasValueResult(data: Data, path: string, ignoreCase?: boolean): Result; //#endregion export { hasValue, hasValueResult };