{
  "_id": "@poppinss/object-builder",
  "maintainers": [
    {
      "name": "virk",
      "email": "virk@adonisjs.com"
    },
    {
      "name": "romainlanz",
      "email": "romain.lanz+npm@pm.me"
    },
    {
      "name": "julien-r44",
      "email": "julien@ripouteau.com"
    }
  ],
  "keywords": [],
  "dist-tags": {
    "latest": "1.1.0"
  },
  "author": {
    "name": "Harminder Virk",
    "email": "virk@adonisjs.com"
  },
  "description": "A convenience class to create an object with dynamic properties",
  "readme": "# @poppinss/object-builder\n\n<br />\n\n[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]\n\n## Installation\n\nInstall the package from the npm package registry.\n\n```sh\n# Npm\nnpm i @poppinss/object-builder\n\n# Yarn\nyarn add @poppinss/object-builder\n\n# Pnpm\npnpm add @poppinss/object-builder\n```\n\n## Usage\n\nThe `ObjectBuilder` is a convenience class to create an object with dynamic properties. Consider the following example, where we wrap our code inside conditionals before adding the property `b` to the `startingObject`.\n\n```ts\nconst startingObject = {\n  a: 1\n  // Add \"b\", if it exists\n  ...(b ? { b } : {})\n}\n\n// OR\nif (b) {\n  startingObject.b = b\n}\n```\n\nInstead of writing conditionals, you can consider using the Object builder fluent API.\n\n```ts\nimport { ObjectBuilder } from '@poppinss/object-builder'\nconst builder = new ObjectBuilder({ a: 1 })\n\nconst plainObject = builder.add('b', b).toObject()\n```\n\nBy default, only the `undefined` values are ignored. However, you can also ignore `null` values.\n\n```ts\nimport { ObjectBuilder } from '@poppinss/object-builder'\n\nconst ignoreNullValues = true\nconst builder = new ObjectBuilder({ a: 1 }, ignoreNullValues)\n```\n\nFollowing are the available methods on the `ObjectBuilder` class.\n\n```ts\nbuilder.remove(key)\nbuilder.has(key)\nbuilder.get(key)\nbuilder.add(key)\n\nbuilder.toObject() // get plain object\n```\n\n## Contributing\n\nOne of the primary goals of Poppinss is to have a vibrant community of users and contributors who believes in the principles of the framework.\n\nWe encourage you to read the [contribution guide](https://github.com/poppinss/.github/blob/main/docs/CONTRIBUTING.md) before contributing to the framework.\n\n## Code of Conduct\n\nIn order to ensure that the Poppinss community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/poppinss/.github/blob/main/docs/CODE_OF_CONDUCT.md).\n\n## License\n\nPoppinss object builder is open-sourced software licensed under the [MIT license](LICENSE.md).\n\n[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/poppinss/object-builder/checks.yml?style=for-the-badge\n[gh-workflow-url]: https://github.com/poppinss/object-builder/actions/workflows/checks.yml 'Github action'\n[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript\n[typescript-url]: \"typescript\"\n[npm-image]: https://img.shields.io/npm/v/@poppinss/object-builder.svg?style=for-the-badge&logo=npm\n[npm-url]: https://npmjs.org/package/@poppinss/object-builder 'npm'\n[license-image]: https://img.shields.io/npm/l/@poppinss/object-builder?color=blueviolet&style=for-the-badge\n[license-url]: LICENSE.md 'license'\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/poppinss/object-builder.git"
  },
  "bugs": {
    "url": "https://github.com/poppinss/object-builder/issues"
  },
  "license": "MIT",
  "versions": {
    "1.1.0": {
      "name": "@poppinss/object-builder",
      "description": "A convenience class to create an object with dynamic properties",
      "version": "1.1.0",
      "engines": {
        "node": ">=20.6.0"
      },
      "type": "module",
      "main": "build/index.js",
      "exports": {
        ".": "./build/index.js"
      },
      "scripts": {
        "pretest": "npm run lint",
        "test": "c8 npm run quick:test",
        "lint": "eslint .",
        "format": "prettier --write .",
        "typecheck": "tsc --noEmit",
        "precompile": "npm run lint",
        "compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
        "build": "npm run compile",
        "version": "npm run build",
        "prepublishOnly": "npm run build",
        "release": "release-it",
        "quick:test": "node --import=ts-node-maintained/register/esm --enable-source-maps bin/test.ts"
      },
      "devDependencies": {
        "@adonisjs/eslint-config": "^2.0.0-beta.6",
        "@adonisjs/prettier-config": "^1.4.0",
        "@adonisjs/tsconfig": "^1.4.0",
        "@japa/assert": "^4.0.0",
        "@japa/expect": "^3.0.2",
        "@japa/expect-type": "^2.0.2",
        "@japa/file-system": "^2.3.1",
        "@japa/runner": "^3.1.4",
        "@release-it/conventional-changelog": "^9.0.4",
        "@swc/core": "^1.10.1",
        "@types/node": "^22.10.2",
        "c8": "^10.1.3",
        "eslint": "^9.17.0",
        "prettier": "^3.4.2",
        "release-it": "^17.11.0",
        "ts-node-maintained": "^10.9.4",
        "tsup": "^8.3.5",
        "typescript": "^5.7.2"
      },
      "homepage": "https://github.com/poppinss/object-builder#readme",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/poppinss/object-builder.git"
      },
      "bugs": {
        "url": "https://github.com/poppinss/object-builder/issues"
      },
      "keywords": [],
      "author": {
        "name": "Harminder Virk",
        "email": "virk@adonisjs.com"
      },
      "license": "MIT",
      "publishConfig": {
        "access": "public",
        "provenance": true
      },
      "tsup": {
        "entry": [
          "index.ts"
        ],
        "outDir": "./build",
        "clean": true,
        "format": "esm",
        "dts": false,
        "sourcemap": true,
        "target": "esnext"
      },
      "release-it": {
        "git": {
          "requireCleanWorkingDir": true,
          "requireUpstream": true,
          "commitMessage": "chore(release): ${version}",
          "tagAnnotation": "v${version}",
          "push": true,
          "tagName": "v${version}"
        },
        "github": {
          "release": true
        },
        "npm": {
          "publish": true,
          "skipChecks": true
        },
        "plugins": {
          "@release-it/conventional-changelog": {
            "preset": {
              "name": "angular"
            }
          }
        }
      },
      "c8": {
        "reporter": [
          "text",
          "html"
        ],
        "exclude": [
          "tests/**"
        ]
      },
      "prettier": "@adonisjs/prettier-config",
      "_id": "@poppinss/object-builder@1.1.0",
      "gitHead": "c7811bbcdfde93d5e4d3cdfb8c030bbede827d58",
      "types": "./build/index.d.ts",
      "_nodeVersion": "20.18.1",
      "_npmVersion": "10.8.2",
      "dist": {
        "integrity": "sha512-FOrOq52l7u8goR5yncX14+k+Ewi5djnrt1JwXeS/FvnwAPOiveFhiczCDuvXdssAwamtrV2hp5Rw9v+n2T7hQg==",
        "shasum": "a1266ef397a419cbe64be611373ccf5ba7f90ee4",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@poppinss/object-builder/-/object-builder-1.1.0.tgz",
        "fileCount": 6,
        "unpackedSize": 12611,
        "attestations": {
          "url": "https://registry.npmjs.org/-/npm/v1/attestations/@poppinss%2fobject-builder@1.1.0",
          "provenance": {
            "predicateType": "https://slsa.dev/provenance/v1"
          }
        },
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQD1IayJ8Jnoukpne7SfosxvaymnAMwTMesicM3k8A1sDQIhAMbgzYlv1p7tM+xsP1jV0hwFI/EXoT33sGvddPOvH0Zz"
          }
        ]
      },
      "_npmUser": {
        "name": "virk",
        "email": "virk@adonisjs.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "virk",
          "email": "virk@adonisjs.com"
        },
        {
          "name": "romainlanz",
          "email": "romain.lanz+npm@pm.me"
        },
        {
          "name": "julien-r44",
          "email": "julien@ripouteau.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages-npm-production",
        "tmp": "tmp/object-builder_1.1.0_1735018889864_0.9187259309454017"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "@poppinss/object-builder",
  "time": {
    "created": "2024-12-24T05:41:29.458Z",
    "1.1.0": "2024-12-24T05:41:30.018Z",
    "modified": "2026-06-13T12:28:01.741Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/poppinss/object-builder#readme"
}