+{"_id":"chai-dynamodb","name":"chai-dynamodb","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"chai-dynamodb","version":"0.1.0","description":"AWS DynamoDB reserved word assertions for Chai","repository":{"type":"git","url":"git+https://github.com/cadam11/chai-dynamodb.git"},"main":"index.js","scripts":{"lint":"eslint index.js /test","test":"nyc mocha","pretest":"npm run lint"},"keywords":["chai","dynamodb","test","assertions","chai-plugin","aws","reserved"],"author":{"name":"Craig Adam","email":"craig@adam11.ca"},"license":"MIT","devDependencies":{"chai":"^4.2.0","eslint":"^2.8.0","mocha":"^8.2.1","nyc":"^15.1.0"},"peerDependencies":{"chai":">= 4.0.0"},"gitHead":"b573b94dfca16b4b3a0d24bd25770f0dba5c018b","bugs":{"url":"https://github.com/cadam11/chai-dynamodb/issues"},"homepage":"https://github.com/cadam11/chai-dynamodb#readme","_id":"chai-dynamodb@0.1.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-cL6q8UPxyixbalOrAVO4v7PARJdZlJXjRf9gcjTvbHauTPeJn5nki/i6PGdM2VX7a2icScmQCGOgYDG3jZVFsQ==","shasum":"65f900e079dffa642565b9211c2860c316e6eaf2","tarball":"https://registry.npmjs.org/chai-dynamodb/-/chai-dynamodb-0.1.0.tgz","fileCount":5,"unpackedSize":20416,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgCMNrCRA9TVsSAnZWagAAoa4P/ictLxMWa6jcl8xb4rwj\n6wq2k9iKyJKS1+Vh8mB1r8LacSg81R3v+sweo2atPluvvJkqK0ZbuOZsa0Bx\nsIr9VKzh4Aw1Q6T3SYgQAMSfjFJPOu9VRtD7+a2SOf6z+XGpzVsQ0zxUghl3\n7yw3hIzRE593di1gku13ZOq72MBtBY8jkWi9LBDRQ3ndhp8cOcOrbkPe27QN\nuVY+qm5cr1o5PoFmhZPAslPSDEpXEu2siZZELkAKlwtWFH87VmQ7cwnev2Yp\n6GhCWu7xl5tTfZGZelfaIbtroTKNdbyZBfy/guvRkbpD4bCqUN6/r1l2PQ7L\nIm/NeYnvzGrzVIT/N1L/TKjFzKb7CVUnMqwvKcDkApaHbkxnSuWh8KPJdm/m\n0zT2MKjwroIIvp34YHToKHINUV7Uvbzx6shTbhDxP10ZXonJpktVk4vr02FH\nksxYr2t+/4PVah/ZyViUvcuppm+QCBmAYBSsov5UBPfVkUQKM1buRxDmYgZ+\n+PzTV94wXUhcFD2o5uU4jbZcw9/E/ynSs8BckGmpP7M8+2E9+yfukPhYAXOW\nFU92PN9bTGHtL6/cu3JJLKDALxrYnh4XNrvZuLb2fTbEZfkYJiQaxaXj+CnS\nuMtvNoZiw04i1PCALMj8PHNIKWhzKB17QIWFGn5kqGN/0Y9z3wTRzcW1RfhD\nC8nO\r\n=aa4w\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"cadam11","email":"craig@adam11.ca"},"directories":{},"maintainers":[{"name":"cadam11","email":"craig@adam11.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chai-dynamodb_0.1.0_1611187050964_0.5543907240628865"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-20T23:57:30.964Z","0.1.0":"2021-01-20T23:57:31.141Z","modified":"2021-01-20T23:57:33.394Z"},"maintainers":[{"name":"cadam11","email":"craig@adam11.ca"}],"description":"AWS DynamoDB reserved word assertions for Chai","homepage":"https://github.com/cadam11/chai-dynamodb#readme","keywords":["chai","dynamodb","test","assertions","chai-plugin","aws","reserved"],"repository":{"type":"git","url":"git+https://github.com/cadam11/chai-dynamodb.git"},"author":{"name":"Craig Adam","email":"craig@adam11.ca"},"bugs":{"url":"https://github.com/cadam11/chai-dynamodb/issues"},"license":"MIT","readme":"# chai-dynamodb\n\nA [Chai](https://www.chaijs.com/) plugin that adds a matcher to check for the use of a [DynamoDB reserved word](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html) in a string. Very useful for testing AWS Lambda code!\n\n[]()\n[](http://www.tldrlegal.com/license/mit-license)\n[]() \n[](https://www.npmjs.com/package/chai-dynamodb)\n\n## Using\n\nAlso see the [tests](https://github.com/cadam11/chai-dynamodb/tree/master/test/)\n\n### browser-side\n\nInclude chai-dynamodb after Chai:\n\n <script src=\"chai.js\"></script>\n <script src=\"chai-dynamodb.js\"></script>\n\n### server-side\n\nHave chai use chai-dynamodb:\n\n```javascript\nvar chai = require('chai');\nchai.use(require('chai-dynamodb'));\n```\n\n## Assertions\n\nCheck any string for a DynamoDB reserved word that is **not** prefixed by either `#` or `:` (idiomatically used to prefix expression attribute names and values respectively). The assertion is true if the string doesn't have any reserved words that would cause a call to DynamoDB to fail.\n\n### noReservedWords\n\n```javascript\nconst safe = 'id, phone, email';\nconst notSafe = 'id, name, phone, email';\nconst usingAttributeNamePrefix = 'id, #name, phone, email';\nconst usingAttributeValuePrefix = 'username = :name';\n\n// using should-style assertions\nsafe.should.have.noReservedWords();\nnotSafe.should.have.noReservedWords(); // fails\nusingAttributeNamePrefix.should.have.noReservedWords();\nusingAttributeValuePrefix.should.have.noReservedWords();\n\n// using expect-style assertions\nexpect(safe).to.have.noReservedWords();\nexpect(notSafe).to.have.noReservedWords(); // fails\nexpect(usingAttributeNamePrefix).to.have.noReservedWords();\nexpect(usingAttributeValuePrefix).to.have.noReservedWords();\n\n// using tdd assertions\nassert.noReservedWords(safe);\nassert.noReservedWords(notSafe); // fails\nassert.noReservedWords(usingAttributeNamePrefix);\nassert.noReservedWords(usingAttributeValuePrefix);\n```\n\n### noReservedWordsExcept\n\nUseful when there is planned use of specific keywords. Takes a single **string** or **array** of strings as its argument. Not case-sensitive.\n\n```javascript\nconst usingAttributeNamePrefix = 'SET #name = :fullname';\nconst usingAttributeValuePrefix = 'SET username = :name';\nconst missingPrefix = 'SET username = name';\n\n// using should-style assertions\nusingAttributeNamePrefix.should.have.noReservedWordsExcept('set');\nusingAttributeValuePrefix.should.have.noReservedWordsExcept('SET');\nmissingPrefix.should.have.noReservedWordsExcept(['SET', 'NAME']);\nmissingPrefix.should.have.noReservedWordsExcept('SET'); // fails\n\n// using expect-style assertions\nexpect(usingAttributeNamePrefix).to.have.noReservedWordsExcept('set');\nexpect(usingAttributeValuePrefix).to.have.noReservedWordsExcept('SET');\nexpect(missingPrefix).to.have.noReservedWordsExcept(['SET', 'NAME']);\nexpect(missingPrefix).to.have.noReservedWordsExcept('SET'); // fails\n\n// using tdd assertions\nassert.noReservedWordsExcept(usingAttributeNamePrefix, 'set');\nassert.noReservedWordsExcept(usingAttributeValuePrefix, 'SET');\nassert.noReservedWordsExcept(missingPrefix, ['SET', 'NAME']);\nassert.noReservedWordsExcept(missingPrefix, 'SET'); // fails\n```\n\n## Limitations\n\nDynamoDB is an actively developed product at AWS, so it's possible they'll add more to the current reserved list of **573** words. This library can be a helpful early protection against the small mistakes that plague us all, but if it's mission-critical you should probably check https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html yourself.\n","readmeFilename":"README.md"}
0 commit comments