{"name":"bower-json","version":"0.8.4","description":"Read bower.json files with semantics, normalisation, defaults and validation","author":{"name":"Twitter"},"license":"MIT","repository":{"type":"git","url":"https://github.com/bower/bower/tree/master/packages/bower-json"},"main":"lib/json","engines":{"node":">=0.10.0"},"dependencies":{"deep-extend":"^0.5.1","ends-with":"^0.2.0","ext-list":"^2.0.0","sort-keys-length":"^1.0.0","graceful-fs":"^4.1.3","intersect":"^1.0.1"},"devDependencies":{"expect.js":"^0.3.1","mocha":"^2.5.3","request":"^2.64.0","underscore.string":"^3.0.3"},"scripts":{"test":"mocha"},"_id":"bower-json@0.8.4","_nodeVersion":"10.18.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-mMKghvq9ivbuzSsY5nrOLnDtZIJMUCpysqbGaGW3mj88JAcuSi8ZAzIt34vNZjohy0aR9VXLwgPTZGnBX2Vpjg==","shasum":"9c3b375870dcd9581350c1f403f6383dbf6a18b1","tarball":"http://registry-npm.ywwl.com/bower-json/download/bower-json-0.8.4.tgz","fileCount":9,"unpackedSize":16745,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepwJwCRA9TVsSAnZWagAAt6EP/iLmROhMA7T6l+QrVz7k\nguW+epbKS007GM4UFm0HH9LaSJEbjdFBxcZPD3kPQ9w4qBZj5vBEownnc1AA\n2ORjkYu9dFNimfAyYRzJCT54Sc890rb1SKmaBDBYeEbBrXdLWkeNRRrI13Xv\nnEI4hW9U9c1Apz39KejJBZwGj+nvvtlSGGMjodlfa3lRHf+g3CxTCCrGtdGr\nTsbo9DPlII7LFKMo6aPCIHKnYA8+ObVJXinFs3sEcowfeNupu1SToiLvK91k\nxkHA+VtnVOlLTsA+nIyTYD33vCkzntiovAyxrznmuID7yxbBs/cbVuT1LRjs\nQH/BnNxqoRqxcbD4nm5j50u7Km+7uk0Nj2fxbtqUc02ywTqGDcW1/0rg9+bX\nmpf/pplL1H9/W9AoTzYC8isKbq37SN0moijG4seNXJXAi4oIgmgwv1zb19ng\n4DTHli/TPpckd22driRW4/lPf3DchvFat0pTelmJC2AtKibnuF5dYXWV5+2i\n2wQ111mGacWQm9bhEDhpjR5VZ4RUYgUix7WEGHWRbORM4B8cvtaJZNr/32xs\n1El3PLwHMVDZ3/iN+SJgA2YECrvVw7FK6XvTEAm6HgBSIH2fv5EV1AIY9bS7\nlV3sLII0aLF/opVQwwRRk4O8JNQ2T1B/7WgOQJPFUnBYPKWiydmvKr+2pqtL\nyBZx\r\n=s8nQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCV2LzeJret7EB3ZYfI8yFhLCL4xbfFIu3u56PCIlxziwIhAM+JslIX0TN2epYl0z6nnii0wh1hw/2BFtXtjlvblJOy"}],"size":5334,"noattachment":false,"key":"/bower-json/-/bower-json-0.8.4.tgz"},"maintainers":[{"email":"desandrocodes@gmail.com","name":"desandro"},{"email":"paul.irish@gmail.com","name":"paulirish"},{"email":"andremiguelcruz@msn.com","name":"satazor"},{"email":"sheerun@sher.pl","name":"sheerun"},{"email":"sindresorhus@gmail.com","name":"sindresorhus"},{"email":"mat@wibbly.org.uk","name":"wibblymat"}],"_npmUser":{"name":"sheerun","email":"sheerun@sher.pl"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bower-json_0.8.4_1588003439608_0.47738435851730965"},"_hasShrinkwrap":false,"readme":"# bower-json\n\nRead `bower.json` files with semantics, normalisation, defaults and validation.\n\nInstall via [npm](https://www.npmjs.org/package/bower-json): `npm install --save bower-json`\n\n## Usage\n\n#### .read(file, options, callback)\n#### .readSync(file, options)\n\nReads `file` and applies normalisation, defaults and validation according to the `bower.json` spec.\nIf the passed `file` does not exist, the callback is called with `error.code` equal to `ENOENT`.\nIf the passed `file` contents are not valid JSON, the callback is called with `error.code` equal to `EMALFORMED`.\nIf the `json` does not comply with the `bower.json` spec, the callback is called with `error.code` equal to `EINVALID`.\n\nIf `file` is a directory, `find()` will be used to search for the json file.\nThe `options` argument is optional and can be omitted. These options will be passed to `parse` method.\n\n\n```js\nvar bowerJson = require('bower-json');\n\n// Can also be used by simply calling bowerJson()\nbowerJson.read('/path/to/bower.json', function (err, json) {\n    if (err) {\n        console.error('There was an error reading the file');\n        console.error(err.message);\n        return;\n    }\n\n    console.log('JSON: ', json);\n});\n```\n\n\n#### .parse(json, options)\n\nParses an object. Useful when you want to apply normalisation and validation directly to an object.\nIf the `json` does not comply with the `bower.json` spec, an error is thrown with `error.code` equal to `EINVALID`.\n\nThe `options` arguments is optional and can be omitted. Available options:\n\n- validate: Apply validation, defaults to `true`\n- normalize: Apply normalisation, defaults to `false`\n- clone: clone, use and return the passed in `json` object instead of using it directly, defaults to `false`\n\n\n```js\nvar bowerJson = require('bower-json');\n\nvar json = {\n    name: 'my-package',\n    version: '0.0.1'\n};\n\ntry {\n    bowerJson.parse(json);\n} catch (err) {\n    console.error('There was an error parsing the object');\n    console.error(err.message);\n}\n```\n\n#### .getIssues(json) - DEPRECATED\n\nValidates the passed `json` object.\n\nReturns an object with errors and warnings of this bower.json contents.\n\n```js\nvar bowerJson = require('bower-json');\n\nvar json = {\n    name: 'myPackage',\n    version: '0.0.1',\n    main: {}\n};\n\nvar issues = bowerJson.getIssues(json);\n\nexpect(issues).toEqual({\n  errors: ['The \"main\" field has to be either an Array or a String'],\n  warnings: ['The \"name\" must be lowercase']\n});\n\n#### .validate(json)\n\nValidates the passed `json` object.\n\nThrows an error with `error.code` equal to `EINVALID` if it does not comply with the spec.\n\n```js\nvar bowerJson = require('bower-json');\n\nvar json = {\n    name: 'myPackage',\n    version: '0.0.1'\n};\n\ntry {\n    bowerJson.validate(json);\n} catch (err) {\n    console.error('There was an error validating the object');\n    console.error(err.message);\n}\n```\n\n#### .normalize(json)\n\n```js\nvar bowerJson = require('bower-json');\n\nvar json = {\n    name: 'my-package',\n    version: '0.0.1',\n    main: 'foo.js,bar.js'\n};\n\nbowerJson.normalize(json);\njson.main // ['foo.js', 'bar.js']\n```\n\n\n#### .find(folder, callback)\n#### .findSync(folder)\n\nFinds the `json` filename inside a folder.\nChecks if a `bower.json` exists, falling back to `component.json` (deprecated) and `.bower.json`.\nIf no file was found, the callback is called with a `error.code` of `ENOENT`.\n\n```js\nvar bowerJson = require('bower-json');\n\nbowerJson.find('/path/to/folder', function (err, filename) {\n    if (err) {\n        console.error('There is no json file in the folder');\n        return;\n    }\n\n    console.log('Filename: ', filename);\n\n    // Now that we got the filename, we can read its contents\n    bowerJson.read(filename, function (err, json) {\n        if (err) {\n            console.error('There was an error reading the file');\n            console.error(err.message);\n            return;\n        }\n\n        console.log('JSON: ', json);\n    });\n});\n```\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n","publish_time":1588003439777,"_cnpm_publish_time":1588003439777,"dist-tags":{"latest":"0.8.4"}}