{"_id":"@ampatspell/sofa-util","_rev":"5-2d9655986f39bde39ffd2899ccaf9451","name":"@ampatspell/sofa-util","description":"Utils for sofa libraries","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@ampatspell/sofa-util","version":"0.0.1","description":"Utils for sofa libraries","repository":{"type":"git","url":"git+https://bitbucket.org/ampatspell/s2.git"},"main":"dist/index.js","scripts":{"build":"babel src --out-dir dist","build:watch":"babel src --out-dir dist --watch","lint":"eslint ./src --ext js || true","test":"babel-node node_modules/.bin/_mocha --require test/setup --recursive test","test:watch":"babel-node node_modules/.bin/_mocha --watch --require test/setup --recursive test","cover":"babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha -- --require test/setup --recursive test; open coverage/lcov-report/index.html","prepublish":"npm run test && npm run build"},"keywords":["sofa","util"],"author":{"name":"ampatspell","email":"ampatspell@gmail.com"},"license":"ISC","devDependencies":{"babel":"^5.0.0","babel-core":"^5.0.0","babel-eslint":"^4.1.4","babel-istanbul":"^0.4.1","chai":"^3.4.0","eslint":"^1.8.0","mocha":"^2.3.3"},"dependencies":{"bluebird":"^3.0.5","lodash":"^3.10.1"},"homepage":"https://bitbucket.org/ampatspell/s2#readme","_id":"@ampatspell/sofa-util@0.0.1","_shasum":"3ebd05f3dd996ce1a25095481b59fcd67685081d","_from":".","_npmVersion":"2.14.3","_nodeVersion":"3.3.1","_npmUser":{"name":"ampatspell","email":"ampatspell@gmail.com"},"dist":{"shasum":"3ebd05f3dd996ce1a25095481b59fcd67685081d","tarball":"https://registry.npmjs.org/@ampatspell/sofa-util/-/sofa-util-0.0.1.tgz","integrity":"sha512-8ct5BbiPRZoF+TZO21kzdZxolcQp7DX+U8/7brwZDMaW7PHwHbxV6dOjh3HjXCn45p/2SKSMVl/zvzwhIDKifA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHnpIfGephKw2u5QFZOKpq0F41MNa9iymJvFAYvaFEorAiEA52z/wTeGLHHUb1Tk0rmxhaU4O6lEjohY9tmkHdbpxWs="}]},"maintainers":[{"name":"ampatspell","email":"ampatspell@gmail.com"}]},"0.0.2":{"name":"@ampatspell/sofa-util","version":"0.0.2","description":"Utils for sofa libraries","repository":{"type":"git","url":"git+https://bitbucket.org/ampatspell/s2.git"},"main":"dist/index.js","scripts":{"build":"babel src --out-dir dist","build:watch":"babel src --out-dir dist --watch","lint":"eslint ./src --ext js || true","test":"babel-node node_modules/.bin/_mocha --require test/setup --recursive test","test:watch":"babel-node node_modules/.bin/_mocha --watch --require test/setup --recursive test","cover":"babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha -- --require test/setup --recursive test; open coverage/lcov-report/index.html","prepublish":"npm run test && npm run build"},"keywords":["sofa","util"],"author":{"name":"ampatspell","email":"ampatspell@gmail.com"},"license":"ISC","devDependencies":{"babel":"^5.0.0","babel-core":"^5.0.0","babel-eslint":"^4.1.4","babel-istanbul":"^0.4.1","chai":"^3.4.0","eslint":"^1.8.0","mocha":"^2.3.3"},"dependencies":{"bluebird":"^3.0.5","lodash":"^3.10.1"},"homepage":"https://bitbucket.org/ampatspell/s2#readme","_id":"@ampatspell/sofa-util@0.0.2","_shasum":"b3e635638c42ce6d32da7d34adccc596a83d4eb6","_from":".","_npmVersion":"2.14.3","_nodeVersion":"3.3.1","_npmUser":{"name":"ampatspell","email":"ampatspell@gmail.com"},"dist":{"shasum":"b3e635638c42ce6d32da7d34adccc596a83d4eb6","tarball":"https://registry.npmjs.org/@ampatspell/sofa-util/-/sofa-util-0.0.2.tgz","integrity":"sha512-tmiOIoECSCBiYAolFnVDJqDjA0xB0Lh9OtVVohOSSC8Ia0aUL561qx7v0YxxZkNGk07WXMMzoEP2cRWFkjUl+g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEsUdLxcISXyYiB/CLzj84XNDAnNMiDjg7TwzMRHiee/AiEAoFcT1NL6FCWRJLoW7Vl0uFT13hSPP8bqlqUdydkjr64="}]},"maintainers":[{"name":"ampatspell","email":"ampatspell@gmail.com"}]},"0.0.3":{"name":"@ampatspell/sofa-util","version":"0.0.3","description":"Utils for sofa libraries","repository":{"type":"git","url":"git+https://bitbucket.org/ampatspell/s2-util.git"},"main":"dist/index.js","scripts":{"build":"babel src --out-dir dist","build:watch":"babel src --out-dir dist --watch","lint":"eslint ./src --ext js || true","test":"babel-node node_modules/.bin/_mocha --require test/setup --recursive test","test:watch":"babel-node node_modules/.bin/_mocha --watch --require test/setup --recursive test","cover":"babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha -- --require test/setup --recursive test; open coverage/lcov-report/index.html","prepublish":"npm run test && npm run build"},"keywords":["sofa","util"],"author":{"name":"ampatspell","email":"ampatspell@gmail.com"},"license":"ISC","devDependencies":{"babel":"^5.0.0","babel-core":"^5.0.0","babel-eslint":"^4.1.4","babel-istanbul":"^0.4.1","chai":"^3.4.0","eslint":"^1.8.0","mocha":"^2.3.3"},"dependencies":{"bluebird":"^3.0.5","lodash":"^3.10.1"},"homepage":"https://bitbucket.org/ampatspell/s2-util#readme","_id":"@ampatspell/sofa-util@0.0.3","_shasum":"399c819ddc1765d0cc9398d27bd5b95f9710dfe0","_from":".","_npmVersion":"2.14.3","_nodeVersion":"3.3.1","_npmUser":{"name":"ampatspell","email":"ampatspell@gmail.com"},"dist":{"shasum":"399c819ddc1765d0cc9398d27bd5b95f9710dfe0","tarball":"https://registry.npmjs.org/@ampatspell/sofa-util/-/sofa-util-0.0.3.tgz","integrity":"sha512-Ez6yStc9is+ab8o0OSnR/Wvyn1IDPU0WpK7T9YKtm/Fi2xDU6S6ZngcpkSxFAaD4vAEtZjyF+y2mtHcWW6APdg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRjl31amH9gygNEPmYA0rGrLqj7XKNh0Ktt1v9MfDepQIhAP+LU7iRsV2+q1gyfEUUyVFb5gkP82WgAhHJLtpS+PlV"}]},"maintainers":[{"name":"ampatspell","email":"ampatspell@gmail.com"}]}},"readme":"# sofa-util\n\nBasic helpers for sofa libraries.\n\n``` javascript\nexport {\n  defineInternal,\n  assert,\n  defined,\n  hidePassword,\n  readFile,\n  SofaError\n};\n```\n\n## defineInternal\n\n``` javascript\nimport { defineInternal } from '@ampatspell/sofa-util';\n\nclass Foo {\n  constructor(opts = {}) {\n    defineInternal(this, {\n      name: opts.name\n    });\n  }\n\n  get name() {\n    return this._internal.name;\n  }\n}\n```\n\n## assert\n\nassert helpers. throws `AssertError` with `message`, `error` and `reason` where error is `\"internal\"`.\n\n``` javascript\nimport { assert } from '@ampatspell/sofa-util';\n\nconst {\n  internal\n} = assert;\n\ninternal.notBlank(value, 'name');\ninternal.isString(value, 'name');\ninternal.isOptionalObject(value, 'opts');\ninternal.isObject(value, 'opts');\n\ninternal.ok(foo === bar, 'foo must equal bar');\ninternal.fail('%s is not ok', value);\n```\n\ncustom `error`\n\n``` javascript\nimport { assert } from '@ampatspell/sofa-util';\n\nlet database = new assert.Assert('database');\n\ndatabase.notBlank('', 'something');\n```\n\n## defined\n\n``` javascript\ndefined({ ok: true, error: null, name: undefined })\n// => { ok: true, error: null }\n```\n\n## hidePassword\n\n``` javascript\nhidePassword('http://foo:bar@127.0.0.1:5984')\n// => 'http://foo:***@127.0.0.1:5984'\n```\n\n## readFile\n\n``` javascript\nreadFile('foo.txt').then(buffer => {\n});\n```\n\n## SofaError\n\n``` javascript\nlet error = new SofaError('Not found', {\n  status: 404,\n  error: 'not_found',\n  reason: 'missing'\n});\n\nerror.toJSON() // => { status: 404, error: 'not_found...\n```\n","maintainers":[{"name":"ampatspell","email":"ampatspell@gmail.com"}],"time":{"modified":"2022-06-12T14:39:43.199Z","created":"2015-11-07T18:25:05.829Z","0.0.1":"2015-11-07T18:25:05.829Z","0.0.2":"2015-11-07T19:19:59.570Z","0.0.3":"2015-11-10T19:14:49.609Z"},"homepage":"https://bitbucket.org/ampatspell/s2-util#readme","keywords":["sofa","util"],"repository":{"type":"git","url":"git+https://bitbucket.org/ampatspell/s2-util.git"},"author":{"name":"ampatspell","email":"ampatspell@gmail.com"},"license":"ISC","readmeFilename":"README.md"}