{"_id":"@acastellon/utils","_rev":"6-0d86ccda3cb36919b193f57ea95b308f","name":"@acastellon/utils","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@acastellon/utils","version":"1.0.0","keywords":["utils","javascript","common","tools"],"author":{"name":"Antonio Castellon"},"license":"MIT","_id":"@acastellon/utils@1.0.0","maintainers":[{"name":"acastellon","email":"antonio@castellon.ch"}],"homepage":"https://github.com/antonio-castellon/module-utils#readme","bugs":{"url":"https://github.com/antonio-castellon/module-utils/issues"},"dist":{"shasum":"a9f9dc37e9bfb4a98aad7265bb44e5cf915ba351","tarball":"https://registry.npmjs.org/@acastellon/utils/-/utils-1.0.0.tgz","fileCount":4,"integrity":"sha512-mpWlIhpG0HENzF4tBMDhS8olqHamiQAiZ+mQPIMGJwJIsNeXXwNZ4kf9xPdadXxWp2BQpw6SNHKJP5OyiOOsuw==","signatures":[{"sig":"MEUCIAppmOuRuJII9xg7neo1OgkDGWYpSecYrgB1gwEG57XeAiEAssxGouobMi/Z0/5WZTXHuxj3Ro6+JdsWytKZGSfMHBk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3117,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJen/anCRA9TVsSAnZWagAAz+8P/j+XZ9ZDiIfeD9LFugz1\npu+Zw9voo0n4lkQpy28By192zOiNSX1DxWhuvrC2IfS8Nfk9m4kS/4V6+K8E\nU6ARxR/CpWEJj730FuoD2B8byT0qeCIyOpFWqeVoLM+PgvCVtaHSC9XjIETO\n2nvm1vScr2eeZsoyoDiYfcPgBG2+cve2ocWpHfztbDiQpQFTno7IcXXtINB5\nfI/qIcCVg0HtvsBADOnZJ0bQr8WLcvyqvUVPJWgk/WLXOedCuKLqYB+LYFbU\nk7o1QMRPZ0mSl161z+nYh7jj3jBlJflDysFktNTB1thdTUanpBTsYzHbvNgw\nJdJ6ukxT6tR/QqH4zJuNUCdH29NQnqvz1vTnNMFt74GYvntPmqpCoTERY29n\natZGXbBqMw2aeAYn4o667z3WOKDYdJbLA8lq4+AeIS2McPHhwNIgxgyD5jAf\nmVD4o3APHrVrQ+2Ja5K87wUChH5Ly5jFw3fC6WlEe5nrfW2V3hN2ZjA4K9Jp\ncTT1/eHgeE9qFXDJmBeXzBv1AQDp0W5nqBnSCx0kyzxAVaSAOZ2Pd1DpGUDA\nAGVtLctdlTUL9lyVjUzmCi+gy0fJhkDrPcEDAK+ZyGu3o8aqyi+uiEmg6SfQ\nwuxfcF4NBw1y2IPneFXfQp3f40JwoM1SfpVstBdZUWs9vn9cMkkJJYQ0Y+Wg\nVA8y\r\n=AGY3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"utils.js","gitHead":"03fa9d8f8162d2934d3d3e8ecaee178036dc7565","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"acastellon","email":"antonio@castellon.ch"},"repository":{"url":"git+https://github.com/antonio-castellon/module-utils.git","type":"git"},"_npmVersion":"6.12.1","description":"Common funtion utils for javascript","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/utils_1.0.0_1587541671320_0.965764052128155","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@acastellon/utils","version":"1.0.1","keywords":["utils","javascript","common","tools"],"author":{"name":"Antonio Castellon"},"license":"MIT","_id":"@acastellon/utils@1.0.1","maintainers":[{"name":"acastellon","email":"antonio@castellon.ch"}],"homepage":"https://github.com/antonio-castellon/module-utils#readme","bugs":{"url":"https://github.com/antonio-castellon/module-utils/issues"},"dist":{"shasum":"129043c1976099758958a9e6477f719e32e3a3fb","tarball":"https://registry.npmjs.org/@acastellon/utils/-/utils-1.0.1.tgz","fileCount":4,"integrity":"sha512-B3KQKEtEKg0JAnuvo1fsFt8D7AVXN2Y2Yuv8RpstXtLqrn9KPJBGbjskUwwAzC4EQDsUNsfplELVGJeZwUOWlg==","signatures":[{"sig":"MEUCICarjA7dJQJlTIK/rfUD3jdvc8BTSIXJbr9OEGCFnL4rAiEA8TOPUilbDKwS/64S0sxPnfqIQYt+lbAnHFSoeHXNgBw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3340,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOwetCRA9TVsSAnZWagAAemkP/3jlwS55t6aSPasKgBOp\nl1hlQvMFVAd6WdsUeABzqbPCXEen4eMjjBrgJXAJRog2mS9Zt2lh7tJKAKWR\nLvLlJjEA8Y95cm7jNadFuHPkZKTtJe8qRufkUZLdIUc2ImGaRLJkF2HuaHC+\nWwM3tKTo9eDvJqXbR/+PR9CESBJ0MRuax2GNFA5UZb2frF6zBVfalmNtDvUJ\njHrNL/5JHYsfrn7i1BLgEvibSL8pqXiv4QeZutvdiSDdl8YOGptj/YaD7PaS\nuR1T8lwTHzdS2yEOTsrugkt2PacxSyR30aabPL4vOXQoZ6Qu26mL4OpUNIpC\nuoUfNMKM8kej0vnQIcHvmvFFCmctSFGqTLE7t3BRU4SLK8Q7A10kp3Tk/ezD\njHQyEosOboPu2s8ghB8B8au2VLF5aC3gUZBy6Fg0bZDu9JtNYVfbfqqCVKci\nywCuqqt02lcy5IWIZDXtiTn2rakEPTkn2VlZSKwRG35XBpIQkqyC9JZ0S+YI\ngclT3aMxFE21dEuxHWCxkG9iDxOj3e9uJKIn/O5iXUlwSjx1avIhMqcAYbjY\nETlZQcAog8vrJuJu7X9ATmAaixi39OFlLosL3NnQ86/WuU/jg+35SFII3cSd\ngqV2nMHmxst4x53LYcdxL21iDMkgfQpdBEDcLshr7DCjNxR5ZiYO+R4heORy\nNcZm\r\n=Kvzt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"utils.js","gitHead":"8b5b4566e230765a7596b21353276689dadbd81d","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"acastellon","email":"antonio@castellon.ch"},"repository":{"url":"git+https://github.com/antonio-castellon/module-utils.git","type":"git"},"_npmVersion":"6.14.13","description":"Common funtion utils for javascript","directories":{},"_nodeVersion":"14.17.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/utils_1.0.1_1631258541129_0.9563787472551726","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@acastellon/utils","version":"1.0.2","keywords":["utils","javascript","common","tools"],"author":{"name":"Antonio Castellon"},"license":"MIT","_id":"@acastellon/utils@1.0.2","maintainers":[{"name":"acastellon","email":"antonio@castellon.ch"}],"homepage":"https://github.com/antonio-castellon/module-utils#readme","bugs":{"url":"https://github.com/antonio-castellon/module-utils/issues"},"dist":{"shasum":"20ff2edecb33fd26489883ddc6fec8751a7943a8","tarball":"https://registry.npmjs.org/@acastellon/utils/-/utils-1.0.2.tgz","fileCount":4,"integrity":"sha512-qqKC4kD82ScPR9JgCuZOnFeJvRtJKP6PiGdGnGf9sdy3dFtEgaHjkts7k/v9imzfYCNpLGIID+SfOnaJyHiA9Q==","signatures":[{"sig":"MEYCIQCSSk04soctzy0C90tIDFGu8Xp1n+Tu65R6EWBcqMYiAQIhAIgMU8Qok0OVf3H52Iju6L2hcJvDL7hqWmvjft7+PCJB","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3342,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhPv2pCRA9TVsSAnZWagAA77kP/3M/v3Olecfrx7QJC+ju\n+3MP/HKGlfiKZ8QdQYCST133gPpk7cOs6ro7u55Wxr6RuH7PKwJc4GFfaKlB\nUrRYWGd8kZNjJwHsaUnRcqC+5k+eEEoVa70XCQslebK2Z1w4xzpcZI1gO3Qt\nQoKO9FD+8YbCbPsBf2fdObJ6Flhp6FbDQVfwJSb5TJgTGuddXhE84Pda/y2J\ng7NUBri5M7E1btN61vRv9iBEW4K9AMMHscLzabPmXMq+L+RG4BDBjLX5jGra\nlkcb+8yTg1DWipuVKa6mAQb2J55Eljq5sd2Afo2epGy9XegSsER9GpA3trao\nFarsrxU42bSx5H/d3MAhQtzEh6Lb8fdBc7fBW+k9CAnvXCiDBW8Gqmi/tlyv\n6DNLsYBZVfLFqXXm9UXeZ5zfv5KMJLoSM9MZDQNfhKIHl0DIE1ngKY9oWdjs\nWQ+fuQgRl557aF9QXzTjbswMJ/pqv6eglN3A5ficGiNzzhqMlKV0i8gCQstl\n6bSoD1EzeiEaDhXuPQJDFw1iVGUd9py3SSCpb3d8G6E0wa8vPGZLjF3PbM0u\nuQosIgPzf3+jabA7ClkqN/KqbxvBtAppQoYPrqDfDVqLM6biytZ/9/jX+RYH\nMrQVx1dPQprkBb6MRKYFLn8jwaW6NGMCyGrV8axKGfLxjVgAB/pecihDfgGM\n6q/2\r\n=RDkL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"utils.js","gitHead":"c9bebaeef8cffbd2c7936a43aab8a96e09d4f568","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"acastellon","email":"antonio@castellon.ch"},"repository":{"url":"git+https://github.com/antonio-castellon/module-utils.git","type":"git"},"_npmVersion":"6.14.13","description":"Common funtion utils for javascript","directories":{},"_nodeVersion":"14.17.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/utils_1.0.2_1631518121059_0.48346164704337524","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@acastellon/utils","version":"1.0.3","keywords":["utils","javascript","common","tools"],"author":{"name":"Antonio Castellon"},"license":"MIT","_id":"@acastellon/utils@1.0.3","maintainers":[{"name":"acastellon","email":"antonio@castellon.ch"}],"homepage":"https://github.com/antonio-castellon/module-utils#readme","bugs":{"url":"https://github.com/antonio-castellon/module-utils/issues"},"dist":{"shasum":"40ad9bec836a30c9c56adbe9cc2deeb10cab4a5d","tarball":"https://registry.npmjs.org/@acastellon/utils/-/utils-1.0.3.tgz","fileCount":4,"integrity":"sha512-/XSaqPgLksOjG5QOi1J0XhERBbA3quMHKxcA7mT7i21ibGSZdQXnV9laRoqDZa2F3dgjR/era4QuIbtHDx5YPQ==","signatures":[{"sig":"MEUCIQDhOg3FuuQroyrROpXlUv8sIbEKOGsMRHIAX2xV5MSbTgIgBqBkDzWvDF+4GD4qjElz/U8mkJIpyBGBJEGgTYU69TU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3352,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJicjNeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrLyw//TAwEsJBlBlqL7m/76DuIHT8PqP8dlkxIoTOOP3tXSuS6lMNp\r\nVSMqWAyy0+hfgfzesosDc8l1Lr56WLeh1OZIxHltdmwLOxcscb2sIkvk+vyw\r\niWqMvwtApTtx2CChSI5hHHyubo57pOvAgEEiw5MAorW/4ajRIH+EdyH5Lnmu\r\nKlEZ+d2oaUImEjT0qTKP2iYNtPuRQpV95vgKa6yRHvamA5gAPmbM0lO+Vomh\r\n/XJAGsIttEc5eEiNgKsJFnj1jJND+4M2MErMwiSe3IbLQTj3OJwSOHWVa9jo\r\n9S0/ggSrfQt4Rs5bwkCyH/MEb1oOxMpdelnU4ELPCHJ0iCr+bVuFDtpKxwsi\r\nmwkaUyImHDNXmvCIokRkIIn+4MYQ8BH32fi0lKMTc7mEYm6yzJSznkUr/+ms\r\n3Zb+xY3POnmjje1rUGbCIF4ykFRq20DawqKXs6rNsDYy/5kNCJhjfXB4OTp4\r\nFJdJF87CDOYn3tIApa0s6sJ+dXYrIUh/hNJ6j3/qhiky0nqmBn4rdpjqTTBu\r\niYsSw2ZNCI7MX7syKX95NFfwu4ttpklUlioZMOCcLOuvzbz938YNogi6jWLt\r\nw/AF6TywAwqBtSFkYjTolAFN+W9f+DB0UqlgWkj/6yVKSGs/vH53Z/IEZeh8\r\nqxpyyNu3KuhEqU/PR7jF/uv7x1I28Ldi/e4=\r\n=cyh0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"utils.js","gitHead":"aa7e4823c33161e73f74b9a8d5b6e0a9a994df88","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"acastellon","email":"antonio@castellon.ch"},"repository":{"url":"git+https://github.com/antonio-castellon/module-utils.git","type":"git"},"_npmVersion":"6.14.13","description":"Common funtion utils for javascript","directories":{},"_nodeVersion":"14.17.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/utils_1.0.3_1651651422357_0.9177500300643833","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@acastellon/utils","version":"1.2.0","description":"Common function utils for javascript","main":"utils.js","scripts":{"test":"node test.js"},"repository":{"type":"git","url":"git+https://github.com/antonio-castellon/module-utils.git"},"keywords":["utils","javascript","common","tools"],"author":{"name":"Antonio Castellon"},"license":"MIT","bugs":{"url":"https://github.com/antonio-castellon/module-utils/issues"},"homepage":"https://github.com/antonio-castellon/module-utils#readme","engines":{"node":">=18.0.0"},"_id":"@acastellon/utils@1.2.0","gitHead":"3aaaf6209ffb09f6a637ec4b9c333b06abd58f05","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-KV0vme3EHHyRpkLt+rExEAMByK8tL/aSh0o8URPh/Fgh2zL3KrF6G45032sKmeBP2LdeQM14zZyHWkIdaUl71A==","shasum":"cb8bf6256a065894502bcf74fd3128f9d51c3a6e","tarball":"https://registry.npmjs.org/@acastellon/utils/-/utils-1.2.0.tgz","fileCount":4,"unpackedSize":6799,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBBwwGXuCaCw7ukYpZn+tIQQDz6HpGPPWa9xlCl2bq2YAiEAwBOgPbIRdMLsQncFC53nIS45mU6N98F2G37bhe04JAY="}]},"_npmUser":{"name":"acastellon","email":"antonio@castellon.ch"},"directories":{},"maintainers":[{"name":"acastellon","email":"antonio@castellon.ch"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/utils_1.2.0_1780483646960_0.5192613211255817"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-22T07:47:51.274Z","modified":"2026-06-03T10:47:27.213Z","1.0.0":"2020-04-22T07:47:51.526Z","1.0.1":"2021-09-10T07:22:21.342Z","1.0.2":"2021-09-13T07:28:41.179Z","1.0.3":"2022-05-04T08:03:42.528Z","1.2.0":"2026-06-03T10:47:27.092Z"},"bugs":{"url":"https://github.com/antonio-castellon/module-utils/issues"},"author":{"name":"Antonio Castellon"},"license":"MIT","homepage":"https://github.com/antonio-castellon/module-utils#readme","keywords":["utils","javascript","common","tools"],"repository":{"type":"git","url":"git+https://github.com/antonio-castellon/module-utils.git"},"description":"Common function utils for javascript","maintainers":[{"name":"acastellon","email":"antonio@castellon.ch"}],"readme":"# @acastellon/utils\r\n\r\nMinor common utils for javascript.\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install @acastellon/utils\r\n```\r\n\r\n## Usage\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\n\r\nif (utils.isNotEmpty(someValue)) { ... }\r\nif (utils.isAnySQLInjection(userInput)) { throw new Error('injection'); }\r\nconsole.log( utils.existProperty(foo) );\r\n```\r\n\r\n## API\r\n\r\nAll functions are attached to the returned model.\r\n\r\n### existProperty(prop: any): boolean\r\n\r\nReturns true if prop is non-null, defined, and either a non-empty string or a number.\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\n\r\nconsole.log(utils.existProperty('hello')); // true\r\nconst config = { host: 'localhost' };\r\nconsole.log(utils.existProperty(config.host)); // true\r\nconsole.log(utils.existProperty('')); // false\r\n```\r\n\r\n### isNotNull(data: any): boolean\r\n\r\nAlias-ish for defined + not empty.\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\nconsole.log(utils.isNotNull('value')); // true\r\nconsole.log(utils.isNotNull(null)); // false\r\n```\r\n\r\n### isEmpty(data: any): boolean\r\n\r\nNegation of isNotEmpty.\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\nconsole.log(utils.isEmpty('')); // true\r\nconsole.log(utils.isEmpty({})); // true\r\n```\r\n\r\n### isNotEmpty(data: any): boolean\r\n\r\nTrue for non-undefined/non-null values that are either non-empty objects (keys) or have string length >0.\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\nconsole.log(utils.isNotEmpty({a:1})); // true\r\nconsole.log(utils.isNotEmpty([])); // false\r\nconsole.log(utils.isNotEmpty(42)); // true\r\n```\r\n\r\n### isNotUndefined(data: any): boolean\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\nconsole.log(utils.isNotUndefined(0)); // true\r\nconsole.log(utils.isNotUndefined(undefined)); // false\r\n```\r\n\r\n### isUndefined(data: any): boolean\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\nconsole.log(utils.isUndefined(undefined)); // true\r\n```\r\n\r\n### isAnObject(data: any): boolean\r\n\r\n`typeof === 'object'` (arrays and null-ish are true here).\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\nconsole.log(utils.isAnObject({})); // true\r\nconsole.log(utils.isAnObject('string')); // false\r\n```\r\n\r\n### isAnySQLInjection(data: any): boolean\r\n\r\nChecks for presence of UPDATE/DROP/DELETE/INSERT/CREATE (only on strings).\r\n\r\n**Example:**\r\n\r\n```js\r\nconst utils = require('@acastellon/utils')();\r\nconsole.log(utils.isAnySQLInjection('DROP TABLE users')); // true\r\nconsole.log(utils.isAnySQLInjection('SELECT * FROM x')); // false\r\nconsole.log(utils.isAnySQLInjection(123)); // false\r\n```\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md"}