{"id":16387405,"url":"https://github.com/arb/white-out","last_synced_at":"2025-03-21T02:31:25.471Z","repository":{"id":66139935,"uuid":"57059236","full_name":"arb/white-out","owner":"arb","description":"Transform stream to censor object data.","archived":false,"fork":false,"pushed_at":"2020-02-08T15:38:20.000Z","size":15,"stargazers_count":8,"open_issues_count":7,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T19:52:14.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-25T16:48:12.000Z","updated_at":"2023-01-10T03:16:57.000Z","dependencies_parsed_at":"2023-04-16T07:17:11.600Z","dependency_job_id":null,"html_url":"https://github.com/arb/white-out","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arb%2Fwhite-out","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arb%2Fwhite-out/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arb%2Fwhite-out/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arb%2Fwhite-out/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arb","download_url":"https://codeload.github.com/arb/white-out/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244725552,"owners_count":20499628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T04:26:29.072Z","updated_at":"2025-03-21T02:31:24.799Z","avatar_url":"https://github.com/arb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# white-out\n\n[![Current Version](https://img.shields.io/npm/v/white-out.svg)](https://www.npmjs.org/package/white-out)\n[![Travis CI](https://travis-ci.org/arb/white-out.svg?branch=master)](https://travis-ci.org/arb/white-out)\n[![belly-button-style](https://cdn.rawgit.com/continuationlabs/belly-button/master/badge.svg)](https://github.com/continuationlabs/belly-button)\n\nA transform stream used to censor data from objects before passing them down the pipeline.\n\n**white-out 2.x mutates the target object passed (unless immutable option is enabled), which may lead to undesirable results such as keys being undefined, changed, etc.**\n\n## `new WhiteOut (filter, [options])`\n\nCreates a new `WhiteOut` transform stream with the following arguments.\n- `filter` - a key value pair where `key` is the property value to censor on the object payload and the `value` is the censor type.\n  - Valid options for `value` are \"censor\", \"remove\" and a RegExp.\n    - \"censor\" - replaces the value with a string of \"X\"s.\n    - \"remove\" - completely removes the key from object\n    - Anything else will be treated as a `RegExp` definition and will be passed into `new RegExp`.\n- `[options]` - Additional constructor options. Defaults to `{}`.\n  - `[root]` - an object string path (ex `'response.payload'`) that will be used when the censor algorithm starts. Useful for censoring only a subsection of the entire `data` object. Defaults to `undefined` which means the entire `data` object will be traversed. For performance reasons, it is recodmended to set `root` to only the specific segment of `data` you wish to filter.\n  - `[stream]` - additional options to pass into the transform stream constructor. `objectMode` is always `true`.\n  - `[immutable]` - change processing mode to immutable, so source object want be modified. Default to false.\n\n## Examples\n\n```js\nconst wo = new WhiteOut({ password: 'remove' });\nwo.write({\n  name: 'John Smith',\n  age: 55,\n  values: [1,2,3],\n  password: 'hunter1',\n  foo: {\n    password: 'hunter1',\n    value: 10\n  }\n});\n/* results in\n{\n  name: 'John Smith',\n  age: 55,\n  values: [1,2,3],\n  foo: {\n    value: 10\n  }\n}\n*/\n```\n\n```js\nconst wo = new WhiteOut({ password: 'remove', { root: 'foo' } });\nwo.write({\n  name: 'John Smith',\n  age: 55,\n  values: [1,2,3],\n  password: 'hunter1',\n  foo: {\n    password: 'hunter1',\n    value: 10\n  }\n});\n/* results in\n{\n  name: 'John Smith',\n  age: 55,\n  values: [1,2,3],\n  password: 'hunter1',\n  foo: {\n    value: 10\n  }\n}\n*/\n```\n\n```js\nconst wo = new WhiteOut({ ssn: 'remove', age: 'censor' });\n\nwo.write([{\n  name: 'Moe',\n  age: 44,\n  ssn: 123\n}, {\n  name: 'Larry',\n  age: 41,\n  ssn: 34343\n}, {\n  name: 'Shemp',\n  age: 38,\n  ssn: 9923\n}]);\n/* results in\n[{ name: 'Moe', age: 'XX' }, { name: 'Larry', age: 'XX' }, { name: 'Shemp', age: 'XX' }]\n*/\n```\n\n```js\nconst wo = new WhiteOut({ password: '^.{3}' });\nwo.write({\n  values: [{\n    name: 'Moe',\n    password: 'password1'\n  }, {\n    name: 'Larry',\n    password: 'password2'\n  }, {\n    name: 'Shemp',\n    password: 'password3'\n  }]\n});\n/*\nresults in\n{\n  values: [{\n    name: 'Moe',\n    password: 'XXXsword1'\n  }, {\n    name: 'Larry',\n    password: 'XXXsword2'\n  }, {\n    name: 'Shemp',\n    password: 'XXXsword3'\n  }]\n}\n*/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farb%2Fwhite-out","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farb%2Fwhite-out","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farb%2Fwhite-out/lists"}