-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ChaiJs Bot
committed
Apr 12, 2021
1 parent
2c8979a
commit 77c005a
Showing
4 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"_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[![NPM Version](https://img.shields.io/npm/v/chai-dynamodb.svg?style=flat)]()\n[![NPM License](https://img.shields.io/npm/l/chai-dynamodb.svg?style=flat)](http://www.tldrlegal.com/license/mit-license)\n[![NPM Downloads](https://img.shields.io/npm/dt/chai-dynamodb.svg?style=flat)]() \n[![NPM](https://nodei.co/npm/chai-dynamodb.png?downloads=true)](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"} | ||
{"_id":"chai-dynamodb","_rev":"2-2d7af8a8628a33cdd8d8df1fd22ada40","name":"chai-dynamodb","dist-tags":{"latest":"1.0.1"},"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},"1.0.0":{"name":"chai-dynamodb","version":"1.0.0","description":"AWS DynamoDB reserved word assertions for Chai","repository":{"type":"git","url":"git+https://github.com/cadam11/chai-dynamodb.git"},"main":"./index","types":"./types/index.d.ts","scripts":{"build":"yarn build:js && yarn build:ts","prebuild:js":"rm -rf dist && mkdir dist","build:js":"simplifyify lib/dynamodb.js --outfile dist/chai-dynamodb.js --bundle --debug --minify --standalone chaiDynamodb","build:ts":"cd types && tsc","lint":"eslint index.js /test","pretest":"yarn lint","test":"nyc mocha"},"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","simplifyify":"^8.0.4","typescript":"^4.2.4"},"peerDependencies":{"chai":">= 4.0.0"},"dependencies":{"@types/chai":"^4.2.16"},"engines":{"node":">=10"},"gitHead":"4b98abcc78d5c07db77ac0037a6f31bde4859458","bugs":{"url":"https://github.com/cadam11/chai-dynamodb/issues"},"homepage":"https://github.com/cadam11/chai-dynamodb#readme","_id":"chai-dynamodb@1.0.0","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-CBOw+KwWxM12Qu2dXG5eqciA5s9RneDM3SQ/sqzjySyuF1SBfRxE2gxm3NY+4gN6ILZi5LJS043PYj0dArNqSA==","shasum":"eaea71516be4174e93edb5495b70c6782acdce11","tarball":"https://registry.npmjs.org/chai-dynamodb/-/chai-dynamodb-1.0.0.tgz","fileCount":8,"unpackedSize":21072,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgcyEnCRA9TVsSAnZWagAA1swQAInUhBJ2SuFZ18skyW4U\nPDSkZMYZxosMSdWNO/pE8V2H+x7h+mGg+pvfyYZJg17V0+96hcKCKdrw83bC\nVHGWZn1FATucXEyQGTjg9UhZltRSrwHzm5w2JjByKZ29eMoRiDPUcA3wdcoP\nT8yurWeKwjkSajPJTHJhsJHwiLQsyt0UfUNuNknxCfjc9uNKVksusTIHfKdS\nlSzHElTRBfArrTkhnR09Haeb+bACCXRqgrjd8FjbzR061LPNDl6RfhgAH+Yh\nPkGXA3e3dWe45+vJtL2ghkJPBVG1YdVOhQKvJVWW8gVOJIZ5ufMmQg9nDmpP\nICnUIVVll1UObqVH0b6PXOnl7MMZT4gLfIN7IpSFT6fVbFRCHrQ9T1ELxzAW\nBqYvq930ex3D72xp3DsYhMq84iEBcEH2/KqeStNg8A4pB6aRvJLy9zTvZHx2\n1yprq8TrtwR7cXyIBU1vWr/igvESrGrix8mf3ocGUW0hkOw5MEa4/pqTkiUv\ntPlm/SavrByspwRIj4P4bZu6sXBWM7FXXWK72Jg5+o+963k6i5gqDrTHjrxN\njzyeL4EKUVLou0RY1PyAYraNfigSQGQm8OOsboXM79dFu30ZifjZkEbrWoDf\nyDUVduV6al08+Z5VGRm9xtNWnUDkDFpo0c7louayaC2rBBPqu33B7RrXNEI3\noGxh\r\n=0cPq\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_1.0.0_1618157862569_0.9390099081690413"},"_hasShrinkwrap":false},"1.0.1":{"name":"chai-dynamodb","version":"1.0.1","description":"AWS DynamoDB reserved word assertions for Chai","repository":{"type":"git","url":"git+https://github.com/cadam11/chai-dynamodb.git"},"main":"./index","types":"./types/index.d.ts","scripts":{"build":"yarn build:js && yarn build:ts","prebuild:js":"rm -rf dist && mkdir dist","build:js":"simplifyify lib/dynamodb.js --outfile dist/chai-dynamodb.js --bundle --debug --minify --standalone chaiDynamodb","build:ts":"cd types && tsc","lint":"eslint index.js /test","pretest":"yarn lint","test":"nyc mocha"},"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","simplifyify":"^8.0.4","typescript":"^4.2.4"},"peerDependencies":{"chai":">= 4.0.0"},"dependencies":{"@types/chai":"^4.2.16"},"engines":{"node":">=10"},"gitHead":"d0e240527847d34c2967dd1ac3b9ed267ffd8eb3","bugs":{"url":"https://github.com/cadam11/chai-dynamodb/issues"},"homepage":"https://github.com/cadam11/chai-dynamodb#readme","_id":"chai-dynamodb@1.0.1","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-GD0PSAUtdR4HXR+9IQSFYMKf4yZ2X7IVDmxUOIl0TRwGSD934ih7T8MIC4aRzk6viwtIqdUkHxKW8sRk33hWKQ==","shasum":"dffc9f0ca6c6decd24f485486f6b2b25cb1fb939","tarball":"https://registry.npmjs.org/chai-dynamodb/-/chai-dynamodb-1.0.1.tgz","fileCount":6,"unpackedSize":27432,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgc16SCRA9TVsSAnZWagAAHt8QAJYMOfq10qZgsD6VCpCT\nvpR8ANv18xmZjsloi6tVRh3fFTwqTAXDBOGeS5LkC9Cf7G50kvE5n5h3EpRs\nwVPjI/pZN15XPtLKSplZ8mcE1Rwh0XMZlw9Rf6wqfbZEqrLMRBmmM8yFjVVo\nx3TlIlNliANv8p5oLCohmiKASOq1WjiQO3qB9A+WxadsryTUiCil4w62gM4N\nVaaDVXjL5YIJPjLQVYMSVzgO4HeCyuhP224+6xTHNizWkfiIUiGvWeigyBl5\nwziUlsMVn9m3DSPsMNLQg8ZayIPumrW8iEOSnvarJ8nMVhxFupcVUfSjA7gF\n7tdPaoy5mN8DbOLlAjcMC2bFucXpQ9v0PkeG+c8aZOg/21cjEwdur984uch5\nBNTSus2yIYBvI5bX0sTsRUyYbdjIo1J6oRpKpp5Q8WNjGaQABXp7NgEFWLth\nWnt5QAGwD6ovEvzhV15ulQ+kOX9D7jkQmdN/3/PXBSQZvgonpInCxGgEXqzk\nOQEY0x6WRdb4RKgux8HQDUYVhzgdJHimGq3Mjsf6BCklDFb+bKXjMvYJbrgD\nMhZrSqWtbXIvpWlaVr1wzh8rdEJ/4Gc9vVsdPRwYu+XuLCqLSsGsSmcv5mBJ\nhcibMfjJ3TX6uRShll42aKxtV03jEfx9epyWZ+16xSoFmJCe/RDoKvj2WDyU\nfQJQ\r\n=uxiu\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_1.0.1_1618173586073_0.13878550169959336"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-20T23:57:30.964Z","0.1.0":"2021-01-20T23:57:31.141Z","modified":"2021-04-11T20:39:48.371Z","1.0.0":"2021-04-11T16:17:42.745Z","1.0.1":"2021-04-11T20:39:46.197Z"},"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[![NPM Version](https://img.shields.io/npm/v/chai-dynamodb.svg?style=flat)]()\n[![NPM License](https://img.shields.io/npm/l/chai-dynamodb.svg?style=flat)](http://www.tldrlegal.com/license/mit-license)\n[![NPM Downloads](https://img.shields.io/npm/dt/chai-dynamodb.svg?style=flat)]() \n[![NPM](https://nodei.co/npm/chai-dynamodb.png?downloads=true)](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"} |
Oops, something went wrong.