{"name":"ycb","version":"2.1.2","author":{"name":"Ric Allinson","email":"allinson@yahoo-inc.com"},"license":"BSD","_id":"ycb@2.1.2","maintainers":[{"name":"caridy","email":"caridy@gmail.com"},{"name":"drewfolta","email":"drew@folta.net"},{"name":"ekashida","email":"ekashida@gmail.com"},{"name":"imalberto","email":"imalberto@gmail.com"},{"name":"isao","email":"isao.yagi@gmail.com"},{"name":"lzhan","email":"lzhan@yahoo-inc.com"},{"name":"mridgway","email":"mcridgway@gmail.com"},{"name":"redonkulus","email":"seth@bertalotto.net"}],"contributors":[{"name":"Drew Folta","email":"folta@yahoo-inc.com"},{"name":"Michael Ridgway","email":"mridgway@yahoo-inc.com"},{"name":"Caridy Patino","email":"caridy@yahoo-inc.com"},{"name":"Isao Yagi","email":"isao@yahoo-inc.com"}],"homepage":"https://github.com/yahoo/ycb#readme","bugs":{"url":"https://github.com/yahoo/ycb/issues"},"dist":{"shasum":"7fac59fd5fa1f7773995196d06a0f49ee1907beb","tarball":"http://registry-npm.ywwl.com/ycb/download/ycb-2.1.2.tgz","fileCount":12,"integrity":"sha512-ZF3fhX2zxp/X45ayd8sWU6UAAoZJNtP6woV3Akzzj1zstzb0BihBLBjQOIKItK4OSi10JMgQZ43FwkRL5ea3bA==","signatures":[{"sig":"MEUCIEtlFFeLmQTrVLUy3PRDyp2quMedVFAiXi6jDcJCnlcqAiEAqxMP6svMCB+CR9l1C1aK4TFshTeJDq/O4mXFnhvkUYw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":51150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3CJpCRA9TVsSAnZWagAAy+4P/3Lf2oxAtrdhCA9oerSU\nyaRIx+a1/+0IBEK7pN2nImMaZu9Fxsq5bzEhRgzR2ihsCwXnsQuzQexCZuL9\n+WNNo0yxFlUVgQbVCdmHzf007nShl6dkb23rpOgmRKh4ybCTQZqZv6NhGkRE\nLyW6pTiWSSwRtP1vSX3WOPouJLXiYNe2WOz5n9TqE2WPoN8cbj1RdBsuWb8u\nM3TfcjSiVddrCcWKQ9/B/zdEky7gXopc0BPZEiLp3lFE6pOxK0x62WdLPhKx\n8n7r41M5+HbG+1ZGeittKCtJ7rrSxh1rcA/493qi2oQstq4dtRE6jsT88Fq0\njszLU8p2TUqvf/xJxn0iGcTyK9QEomRY1s7xi4vb7aaI/nNVFpihYE+wGoQe\nvMWRfga/8APuZ+L2EVv0SLPZNqOFuIVjiGwYJwumIweWVhTEP53jG8AiiaAl\n4to0JSe8Kw/hLZKWmVbH3dbmOhuHmgfONlxy/q8wjLoLYvl8HHMB8wof+FSN\nL2/UBL3ogWGwqs+U2Zn3FGuz9iEaATeNm3pqBDElrM973L6roQcglNW7JFzC\ns/G68HKKYkcmZGNoqSantMBZVdidRnwTeu0WjcuwAVYqCSQnKtGSAUoqoRb9\nz2P0Y90kiEOrIneuQ9K/J7dM9xDeA//6nrE2PQWN4RNgOB92HvPZp5smn7ka\nJ68E\r\n=pAQY\r\n-----END PGP SIGNATURE-----\r\n","size":11255,"noattachment":false,"key":"/ycb/-/ycb-2.1.2.tgz"},"main":"index","engines":{"npm":">1.0","node":">0.4"},"gitHead":"c6f797ed944bfd310e7d81fa648f17cdee4611a5","scripts":{"dev":"mocha tests/unit --recursive --reporter spec -w","lint":"eslint .","test":"mocha tests/unit --recursive --reporter spec","cover":"nyc npm run test","pretest":"npm run lint"},"_npmUser":{"name":"redonkulus","email":"seth@bertalotto.net"},"repository":{"url":"git://github.com/yahoo/ycb.git","type":"git"},"_npmVersion":"6.14.8","description":"YCB is a multi-dimensional configuration library that builds bundles from resource files describing a variety of values.","directories":{},"_nodeVersion":"12.16.2","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.0.1","mocha":"^8.0.1","eslint":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ycb_2.1.2_1598899781605_0.4037800561004776","host":"s3://npm-registry-packages"},"readme":"# Yahoo! Configuration Bundle\n\n![Build Status](https://github.com/yahoo/ycb/actions/workflows/node.js.yml/badge.svg)\n\nYCB is a multi-dimensional configuration library that builds bundles from resource files describing a variety of values. The library allows applications to configure themselves based on multiple dimensions describing locations, languages, environments, etc.\n\n### Install\n\n`npm install ycb --save`\n\n### Usage\n\n```js\nimport YCB from 'ycb';\nconst configArray = [\n    {\n        dimensions: [\n            {\n                environment: {\n                    dev: null,\n                    staging: null,\n                    test: null,\n                    prod: null,\n                },\n            },\n            {\n                device: {\n                    desktop: null,\n                    mobile: {\n                        tablet: null,\n                        smartphone: null,\n                    },\n                },\n            },\n        ],\n    },\n    {\n        settings: ['main'],\n        host: 'example.com',\n        prefix: null,\n    },\n    {\n        settings: ['environment:dev'],\n        host: 'dev.example.com',\n    },\n    {\n        settings: ['environment:staging,test'],\n        host: 'stage.example.com',\n    },\n    {\n        settings: ['device:smartphone'],\n        prefix: 'm.',\n    },\n];\n\nconst ycbObj = new YCB.Ycb(configArray);\nconst computedConfig = ycbObj.read({ environment: 'dev' });\n\nconsole.log(computedConfig.host); // dev.example.com\n```\n\n### Scheduling Changes\n\nWe can schedule configuration changes ahead of time by defining an interval along with a config and using the time aware read method. For example the following program.\n\n```js\nimport YCB from 'ycb';\nconst configArray = [\n    {\n        dimensions: [\n            {\n                environment: {\n                    dev: null,\n                    staging: null,\n                    test: null,\n                    prod: null,\n                },\n            },\n            {\n                region: {\n                    us: null,\n                    ca: null,\n                },\n            },\n        ],\n    },\n    {\n        settings: ['main'],\n        host: 'example.com',\n    },\n    {\n        settings: {\n            dimensions: ['region:us'],\n        },\n        logo: 'logo.png',\n    },\n    {\n        settings: {\n            dimensions: ['region:us'],\n            schedule: {\n                start: '2019-11-28T00:04:00Z',\n                end: '2019-11-29T00:04:00Z',\n            },\n        },\n        logo: 'thanksgiving-logo.png',\n    },\n];\n\nconst ycbObj = new YCB.Ycb(configArray, { cacheInfo: true });\nconst config1 = ycbObj.readTimeAware({ region: 'us' }, 0);\nconst config2 = ycbObj.readTimeAware({ region: 'us' }, 1574899440000);\nconst config3 = ycbObj.readTimeAware({ region: 'us' }, 1574985840001);\nconsole.log(config1);\nconsole.log(config2);\nconsole.log(config3);\n```\n\nwill print\n\n```js\n{ host: 'example.com',\n  logo: 'logo.png',\n  __ycb_expires_at__: 1574899440000 }\n{ host: 'example.com',\n  logo: 'thanksgiving-logo.png',\n  __ycb_expires_at__: 1574985840001 }\n{ host: 'example.com', logo: 'logo.png' }\n```\n\nThese intervals are closed and either `start` or `end` may be omitted to define a one sided interval.\n\nTo support proper cache expiration one may set the `cacheInfo` option, in which case the next time the config will change is added to the returned object.\n\n### Examples\n\nExamples are provided in [the tests directory](https://github.com/yahoo/ycb/tree/main/tests).\n\n### License\n\nBSD see LICENSE.txt\n","publish_time":1598899781715,"_cnpm_publish_time":1598899781715,"dist-tags":{"beta":"1.0.5","latest":"2.3.0"}}