{"_id":"@chanim/js-fsm","_rev":"4-30481ecf57e194cee093666e152f6c2e","name":"@chanim/js-fsm","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@chanim/js-fsm","version":"0.0.1","description":"fsm library for javascript.","main":"lib/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","uglify":"uglifyjs --compress --mangle --output ./dist/index.js -- ./lib/index.js"},"repository":{"type":"git","url":"git+https://github.com/ChanHyuk-Im/js-fsm.git"},"author":{"name":"imchrg1@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/ChanHyuk-Im/js-fsm/issues"},"homepage":"https://github.com/ChanHyuk-Im/js-fsm#readme","type":"module","dependencies":{"uglify-js":"^3.17.4"},"gitHead":"10393e65aba2de6856c0925138db29d3c41fa830","_id":"@chanim/js-fsm@0.0.1","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-nbFPjTsA+LimE6yHmXJT2QOIUzqPM2SM2AsHGRKliAQmUtYrlG6xTdxnQBqB/37SS8uZl9K12n/j8aXw+o7ktQ==","shasum":"c8495e9465e5ffb9f6eaf2256dacf608e0b52faf","tarball":"https://registry.npmjs.org/@chanim/js-fsm/-/js-fsm-0.0.1.tgz","fileCount":4,"unpackedSize":2228,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHLTr2Z7g+QIKtUuJjWqX/YLXHRvHI3dUA7s6ccJ0bJ4AiEA3jDnoHKnzRRvd/aIbZAF4/13+46ol/xs2Di2ahB9tSU="}]},"_npmUser":{"name":"chanim","email":"imchrg1@gmail.com"},"directories":{},"maintainers":[{"name":"chanim","email":"imchrg1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-fsm_0.0.1_1707893815351_0.664372412783861"},"_hasShrinkwrap":false},"0.0.2":{"name":"@chanim/js-fsm","version":"0.0.2","description":"fsm library for javascript.","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","uglify":"uglifyjs --compress --mangle --output ./dist/index.js -- ./lib/index.js"},"repository":{"type":"git","url":"git+https://github.com/ChanHyuk-Im/js-fsm.git"},"author":{"name":"imchrg1@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/ChanHyuk-Im/js-fsm/issues"},"homepage":"https://github.com/ChanHyuk-Im/js-fsm#readme","type":"module","dependencies":{"uglify-js":"^3.17.4"},"gitHead":"abbdd6148d3187f6beb1ec1713e051599dcb7be4","_id":"@chanim/js-fsm@0.0.2","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-tq0kGA9Np634hAQfjOt5cKweaZzoULNTbjBZ3czJ4cy+mMd2xVSRN2mIZ69IPlcp9sdNBPrnQRKoYFxexU/Pnw==","shasum":"a41cb995b23b572d8867ddcc4923e405660fc000","tarball":"https://registry.npmjs.org/@chanim/js-fsm/-/js-fsm-0.0.2.tgz","fileCount":4,"unpackedSize":3405,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfW7TV+NKDSN4Y100zbSTRphjEbMpdjHq3EWE1JAMwcgIhAI+EfntwpnQbir+sQyQ+ZH9NmT8Y+YCZ4UkdKQACMKq7"}]},"_npmUser":{"name":"chanim","email":"imchrg1@gmail.com"},"directories":{},"maintainers":[{"name":"chanim","email":"imchrg1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-fsm_0.0.2_1707894651292_0.16043357645097167"},"_hasShrinkwrap":false},"0.0.3":{"name":"@chanim/js-fsm","version":"0.0.3","description":"fsm library for javascript.","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","uglify":"uglifyjs --compress --mangle --output ./dist/index.js -- ./lib/index.js"},"repository":{"type":"git","url":"git+https://github.com/ChanHyuk-Im/js-fsm.git"},"author":{"name":"imchrg1@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/ChanHyuk-Im/js-fsm/issues"},"homepage":"https://github.com/ChanHyuk-Im/js-fsm#readme","type":"module","dependencies":{"uglify-js":"^3.17.4"},"gitHead":"27e96f6a33e3823273e257629301762c9c8c55ef","_id":"@chanim/js-fsm@0.0.3","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-b1/z78BIZl1luP/ogAFklZbD6y/xCgjF2X3DwHSF672kKkQy5jSfq6Ct98CfBEqEWOsLld+6YCGFNhNzKSxHQw==","shasum":"b0cc30928f08e82ddde64e894798dba4d9d740f8","tarball":"https://registry.npmjs.org/@chanim/js-fsm/-/js-fsm-0.0.3.tgz","fileCount":4,"unpackedSize":4852,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBVjOelm3HfmuNtGpIMfO8ATlTgf7NLIvp9QmlHAxeq3AiB7AbsP+FxhUHWdhiBXwUtlD/tSmLncWJxeK55kDgwDCA=="}]},"_npmUser":{"name":"chanim","email":"imchrg1@gmail.com"},"directories":{},"maintainers":[{"name":"chanim","email":"imchrg1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-fsm_0.0.3_1707897676700_0.4537210617066667"},"_hasShrinkwrap":false},"0.0.4":{"name":"@chanim/js-fsm","version":"0.0.4","description":"fsm library for javascript.","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","uglify":"uglifyjs --compress --mangle --output ./dist/index.js -- ./lib/index.js"},"repository":{"type":"git","url":"git+https://github.com/ChanHyuk-Im/js-fsm.git"},"author":{"name":"imchrg1@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/ChanHyuk-Im/js-fsm/issues"},"homepage":"https://github.com/ChanHyuk-Im/js-fsm#readme","type":"module","keywords":["fsm","jsfsm","fsmjs","js-fsm"],"dependencies":{"uglify-js":"^3.17.4"},"gitHead":"cc40d465d3d569898eb8fbfaaa56c81ff1185bb5","_id":"@chanim/js-fsm@0.0.4","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-15cxQS8cBa8Ikp4N10qeFqqrqURgSGWqcYlYE0aQKn1hVuLnn47QenaXAdSdS3mfMB4fo7Uso2nZs/8to2Iokg==","shasum":"d03f038df5e5d44bd1a21a2a9137919d0e903934","tarball":"https://registry.npmjs.org/@chanim/js-fsm/-/js-fsm-0.0.4.tgz","fileCount":4,"unpackedSize":4903,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDiFkkjk2BXedVRQH6is7wa1wc9vGbswSpjPLLYv6WOcAiEAuwXgF1FDdyN1imIfW1mPQ5bvODILhSwxmBz/3Mf7/+s="}]},"_npmUser":{"name":"chanim","email":"imchrg1@gmail.com"},"directories":{},"maintainers":[{"name":"chanim","email":"imchrg1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-fsm_0.0.4_1707897808361_0.8507432525579997"},"_hasShrinkwrap":false},"0.0.5":{"name":"@chanim/js-fsm","version":"0.0.5","description":"fsm library for javascript.","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","uglify":"uglifyjs --compress --mangle --output ./dist/index.js -- ./lib/index.js"},"repository":{"type":"git","url":"git+https://github.com/ChanHyuk-Im/js-fsm.git"},"author":{"name":"imchrg1@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/ChanHyuk-Im/js-fsm/issues"},"homepage":"https://github.com/ChanHyuk-Im/js-fsm#readme","type":"module","keywords":["fsm","jsfsm","fsmjs","js-fsm"],"dependencies":{"uglify-js":"^3.17.4"},"gitHead":"d5b8dddaed6c5b05490e80675ac5007c1275f474","_id":"@chanim/js-fsm@0.0.5","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-EOtw/B3JJjpnmMYWK1JQ/7SFrDHhN7q06JMfj2SMTbdakcVeP5EIs1p354tp1HKdJBBOUPGe3/OhoxVnaSrhoA==","shasum":"bcfdbe97c9b17b6baa76aa6536c611877f1cf922","tarball":"https://registry.npmjs.org/@chanim/js-fsm/-/js-fsm-0.0.5.tgz","fileCount":5,"unpackedSize":156224,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGesPHhA6DXdAL8FiVORkk9WfuwyWhQwFq2nssYE+zcfAiEAqkivEAMizWXhkhWljnbbypIRL+t/UO4dA038/I1/eY4="}]},"_npmUser":{"name":"chanim","email":"imchrg1@gmail.com"},"directories":{},"maintainers":[{"name":"chanim","email":"imchrg1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-fsm_0.0.5_1707898216583_0.6370665588124107"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-14T06:56:55.262Z","0.0.1":"2024-02-14T06:56:55.534Z","modified":"2024-02-14T08:10:16.895Z","0.0.2":"2024-02-14T07:10:51.479Z","0.0.3":"2024-02-14T08:01:16.986Z","0.0.4":"2024-02-14T08:03:28.515Z","0.0.5":"2024-02-14T08:10:16.740Z"},"maintainers":[{"name":"chanim","email":"imchrg1@gmail.com"}],"description":"fsm library for javascript.","homepage":"https://github.com/ChanHyuk-Im/js-fsm#readme","repository":{"type":"git","url":"git+https://github.com/ChanHyuk-Im/js-fsm.git"},"author":{"name":"imchrg1@gmail.com"},"bugs":{"url":"https://github.com/ChanHyuk-Im/js-fsm/issues"},"license":"ISC","readme":"# js-fsm\nfsm library for javascript.\n\n# Installation\n```bash\nnpm install @chanim/js-fsm\n```\n# Example\n![diagram](./diagram.jpg)\n\n```javascript\nimport FSM from '@chanim/js-fsm';\n\nconst fsm = new FSM([\n  {\n    status: 'IDLE',\n    from: ['STATUS_2'],\n    to: ['STATUS_1', 'STATUS_2'],\n    isFirst: true,\n  },\n  {\n    status: 'STATUS_1',\n    from: ['IDLE'],\n    to: ['STATUS_2'],\n  },\n  {\n    status: 'STATUS_2',\n    from: ['STATUS_1', 'IDLE'],\n    to: ['IDLE'],\n  },\n]);\n\nconsole.log(fsm.configure);\n/*\n{\n  IDLE: {\n    from: [ 'STATUS_2' ],\n    to: [ 'STATUS_1', 'STATUS_2' ],\n    isFirst: true\n  },\n  STATUS_1: { from: [ 'IDLE' ], to: [ 'STATUS_2' ] },\n  STATUS_2: { from: [ 'STATUS_1', 'IDLE' ], to: [ 'IDLE' ] }\n}\n*/\n\nfsm.to('STATUS_1');\nconsole.log(fsm.previousStatus, '->', fsm.currentStatus); // IDLE -> STATUS_1\nfsm.to('STATUS_2');\nconsole.log(fsm.previousStatus, '->', fsm.currentStatus); // STATUS_1 -> STATUS_2\nfsm.to('IDLE');\nconsole.log(fsm.previousStatus, '->', fsm.currentStatus); // STATUS_2 -> IDLE\nfsm.to('STATUS_2');\nconsole.log(fsm.previousStatus, '->', fsm.currentStatus); // IDLE -> STATUS_2\n\nfsm.to('STATUS_1'); // Error: Cannot change status from 'STATUS_2' to 'STATUS_1'.\n\nfsm.reset();\nconsole.log(fsm.previousStatus, '->', fsm.currentStatus); // null -> IDLE\n```\n\n# Usage\n### FSM\n`class` for making fsm instance.\n#### parameter\n`Array` of configure data.\n\nIf `isFirst` is `true`, the first status of fsm will be setting as that status. (* `isFirst` must given at least by one.)\n|key|value type|required|default|example|\n|---|---|---|---|---|\n|status|`string`|o|x|`'IDLE'`|\n|from|`string[]`|o|x|`['STATUS_2']`|\n|to|`string[]`|o|x|`['IDLE', 'STATUS_1']`|\n|isFirst|`boolean`|x|`false`|`true`|\n```javascript\nConfigureData {\n  status: string;\n  from: string[];\n  to: string[];\n  isFirst: boolean;\n}\n```\n\n### to\n`method` for changing status to next status.\n#### parameter\n`STATUS`\n```javascript\nfsm.to('STATUS_1');\n```\n\n### reset\n`method` for reset status.\n\n- `previousStatus` to be `null`.\n- `currentStatus` to be `firstStatus`.\n```javascript\nfsm.reset();\n```\n\n### configure\n`variable` for fsm configure.\n```javascript\nconsole.log(fsm.configure);\n/*\n{\n  IDLE: {\n    from: [ 'STATUS_2' ],\n    to: [ 'STATUS_1', 'STATUS_2' ],\n    isFirst: true\n  },\n  STATUS_1: { from: [ 'IDLE' ], to: [ 'STATUS_2' ] },\n  STATUS_2: { from: [ 'STATUS_1', 'IDLE' ], to: [ 'IDLE' ] }\n}\n*/\n```\n\n### previousStatus\n`variable` for previous status.\n```javascript\nconsole.log(fsm.previousStatus); // IDLE\n```\n\n### currentStatus\n`variable` for current status.\n```javascript\nconsole.log(fsm.currentStatus); // STATUS_1\n```\n","readmeFilename":"README.md","keywords":["fsm","jsfsm","fsmjs","js-fsm"]}