{"_id":"abstract-type","_rev":"30-b9dc99e3dc454198823c177d0cd5b399","name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","dist-tags":{"latest":"0.4.4","alpha":"2.0.0-alpha.10"},"versions":{"0.0.1":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.0.1","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["task","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.6","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","_id":"abstract-type@0.0.1","_shasum":"8625283da005854ab22008f9827b7e663a2fb984","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"8625283da005854ab22008f9827b7e663a2fb984","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.0.1.tgz","integrity":"sha512-CjRCHpTc470pzgdX6EvLFuOWXmcfVgpSpsuCMnCkGHRuqwcR59la+gZm9G0yEXoFJzHrIzw6E1Lmuj93wXuZZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQejXsnLOFrxX3W1DLH+TGzJXyVHiFembDWg2pbSIh9QIgOl7PgKHPVpho9xjwj7AdvYeAXLCoQJgrqcukB7PNhV4="}]},"directories":{}},"0.1.0":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.1.0","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["task","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.6","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"d89e228921eda0255cd21c9a35cad0c136f33d67","_id":"abstract-type@0.1.0","_shasum":"6e1630997afea6bf37c7b83fb1d29d2087a12688","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"6e1630997afea6bf37c7b83fb1d29d2087a12688","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.1.0.tgz","integrity":"sha512-FyIvoR5/Hh3sLguseTZsV7aQqG0EdHRqoY7UW1NFIwla03lJYY6cp6FZ8PyZOU0CwRWdnzIa3g2B+BsHfIP8CA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2/LbcjU0RZPY7iexkbT/4PQvyfTruOHRDB+Bj7mCaQAIhAJ7zod8rLbmAikNPbE0pCRlYLMIpJLNFzVOZ5re60Gy7"}]},"directories":{}},"0.2.0":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.2.0","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["task","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.6","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"b916d4411a590c05093bde13aad673c76d97355c","_id":"abstract-type@0.2.0","_shasum":"8bd4edd9fe5182e4ba805cf9e0ca3346707aee48","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"8bd4edd9fe5182e4ba805cf9e0ca3346707aee48","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.2.0.tgz","integrity":"sha512-QLmWPzpwwXzq/RKelNlIOmMAkmOwVc+9qH7Rq+Wo8lAUCmH8y+Pn688UFK9ADvu3b+fsTDoTiCQVIq3o70c74A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG3B9U3rmhY/qrZDGDZnQ2+NSHKjoN6NpQG/iHm/8rS2AiEAx/E3sbuMTYq/CBm3/lVFnrAMaCn4X+XYuAkHYlf5z2k="}]},"directories":{}},"0.2.1":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.2.1","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["task","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"b6d86a7ed62f5695e3e1f948103e91e43f1aefe1","_id":"abstract-type@0.2.1","_shasum":"8cf5774ee35afb254a3f63b562b1e9540ac4b7be","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"8cf5774ee35afb254a3f63b562b1e9540ac4b7be","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.2.1.tgz","integrity":"sha512-dRqmVwbfeBZ5OTXrDTf2iBTCXTDqhp+pn1/w0XTuzxMEKWxtIXt6TmQrJbeohWeNQs4Oo6wEY8paoy152xz0/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBIs0FwGY96DIYjD+DZSkPsK84IP/VVV9rttapfjxgggIgHQ1Ij04Lz3iGy8l1s2B0BL0UWzP0F6CKGGjl1NW0oek="}]},"directories":{}},"0.2.2":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.2.2","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["task","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"5ae66d6ff87c4477b82963a6c00104813a23d1f4","_id":"abstract-type@0.2.2","_shasum":"41184093e76069e68c8c8b73b3280165ab13edc9","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"41184093e76069e68c8c8b73b3280165ab13edc9","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.2.2.tgz","integrity":"sha512-nhmp0954+xqPVFd0kBI1+b5ZUQqt/GoG+Olr2rXfa5GbK/ul3N3arDynLGzlSBF/0EFogJVJdQwmBFwfYJX3+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBeetC91xScQwX7yIAXkXZciFKxb+NxEJt3xaWFubR1CAiB/37IrTRczzWGyv+8DU2FicSS169XSMuLWwZkpCnKBDw=="}]},"directories":{}},"0.2.3":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.2.3","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["task","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"f90545bbfd964b6f1308eb5ac5c4348ed983df67","_id":"abstract-type@0.2.3","_shasum":"d7ca686dce32ff8bf2c982a9cc1d244e3ac3fd17","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"d7ca686dce32ff8bf2c982a9cc1d244e3ac3fd17","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.2.3.tgz","integrity":"sha512-TLpOn535DE+Q9HJ8CfAJpW4Lk2e8WUY5i0pcxhYJpT/u2Zj2BFxtJ+wU4EJogY44b1AhQtAMy5kp8lhEq+KZyw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC/khXicyvVv/IjkZ83NJ+59D/+Ii7tXdK5sNWZJXrvlAiEAsJLzcDWfIJEq7DxjZgP5E3ra53MMhCW21pvxC5olies="}]},"directories":{}},"0.2.4":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.2.4","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["task","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"12fc855649835a5942b05f352b9a66cef65128f7","_id":"abstract-type@0.2.4","_shasum":"db2dbde47ddfd61cf7a310fac4a71eb73e3352e2","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"db2dbde47ddfd61cf7a310fac4a71eb73e3352e2","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.2.4.tgz","integrity":"sha512-hc5xIcOlAisRYemsB9OOqmi62EpSP0tW+vLFVplo1REcsizJ+a6CZ5F6Qa+UdsP/V3B1XAwJy/2AN5ZgNR1EFg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDD7OeDqv/+wB2rvsbt3WKHrLNt4CR+POyexALPxMREcgIgWjfeDeSnCz0qQ2KATmffikcHJszrSoQoyowt2v0okdM="}]},"directories":{}},"0.3.0":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.3.0","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"4f40a98e6f16ad9482db6783896ae496e3f940fe","_id":"abstract-type@0.3.0","_shasum":"652ca35757726e62914d5da0294f01b96f1fe414","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"652ca35757726e62914d5da0294f01b96f1fe414","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.3.0.tgz","integrity":"sha512-WMh4VciuY4tbjee0X099jWs8aKZFTBIK66BKaJwKRslnbUfLwrTyYoJp1EROZi735QEC0vEhvimAPQ8dSOr0JQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDpSfATD1HQUaF4rd4yEwpdTEzY9qJ/8PQU9H6Imt56UwIgTP7Wl7jMQ5m/9rrzM6lSrKxP0APY5ho2qdAUAzEJVZQ="}]},"directories":{}},"0.3.1":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.3.1","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"acdf5e0b7db63b57fc05e91a2929de35dfe006b2","_id":"abstract-type@0.3.1","_shasum":"68cc2fe4d12ccf69e47f78d7f54e00c5a3b05d6c","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"68cc2fe4d12ccf69e47f78d7f54e00c5a3b05d6c","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.3.1.tgz","integrity":"sha512-8pPJf8LbTj7rey/vTM1nCxnlM/Bhwhae9ujA6Ufqf5Aom16LmIPLDsjHydQqxQpah2jO74Xjx2w/M69TmMJ4lg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEuV2/B2XlWdwM9XrBHb6PSsPDw+gxi+f/pJkgIQ/67aAiAmHvUQvGBPjHanaD26pCJOZQdPRx/IyMqsQPtAwZhfAA=="}]},"directories":{}},"0.3.2":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.3.2","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"0b3a62611e71bd3ff7dfbe4c242b3bfeea5e61a1","_id":"abstract-type@0.3.2","_shasum":"998f0c4f12a85864748349fdd567458f35da0885","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"998f0c4f12a85864748349fdd567458f35da0885","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.3.2.tgz","integrity":"sha512-iM9wvbo6znm2q3tGNDGYeBuv4nAQAJUKN/cFYidtJBm2Apvje3prLWY0ijkBg20Qh2XCm7uvqCbZMZGksdfgyQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPny2g5baKdvHUH4YGgvi8EeZIbQEsN3glpWs2PxMl4QIgNuz0nOS4sLHi7YPHwSYBMqfIY9CwLdxktYgWyHyxdtw="}]},"directories":{}},"0.3.3":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.3.3","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.2.0","coffee-coverage":"^0.6.3","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.3.18","mocha":"~2.1.0","pre-commit":"~1.1.1","rimraf":"~2.2.8","shasum":"1.0.0","sinon":"~1.16.1","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"f8111e102934170056b9ce939998353e13f6198d","_id":"abstract-type@0.3.3","_shasum":"dd3348e66cd860421341e412b9ebff2d20cc869d","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"dd3348e66cd860421341e412b9ebff2d20cc869d","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.3.3.tgz","integrity":"sha512-H0V2r4j31Px9i1WYmssdKZsBGb9uTEoOvzvYLpCHyCgCPRAndBGdX0LoRD0Oze7O0A4RxOChLRwI5ZL9jXoaNg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFADWVJPaLf1YB94FzT2M1T3LDt8Ri+GsqOLsWS2WXqcAiEA+H4bSHq37FY5p6oa7tYPW2k/Np3cmGueBm9WRZvSvkk="}]},"directories":{}},"0.4.0":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.4.0","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.5.0","coffee-coverage":"^1.0.1","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.4.2","mocha":"~2.4.5","pre-commit":"~1.1.1","rimraf":"~2.5.2","shasum":"1.0.0","sinon":"~1.17.3","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"752528564b74408b4e5b5def5b0eae8abcc882d6","_id":"abstract-type@0.4.0","_shasum":"5b8643894b277037ce24cc7807f8eb4c3ac96b5a","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"5b8643894b277037ce24cc7807f8eb4c3ac96b5a","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.4.0.tgz","integrity":"sha512-pJDUYiAEQ4R7rIWRkG79oCC9PVXn6/TOH9597I5WVQqnZYAoH8mKp7oKz0Lq2SV43qhozND7CwP5wP4VLBPl2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDU6Fxy1PLanP83GLLmKUw9Yx124rZNI6E7MJM6h+WkCgIhAKRoZUowPdxuWEEgUGLqGmf3uS0x16wSQ+t5h+pGPIHW"}]},"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/abstract-type-0.4.0.tgz_1456503201038_0.4766208278015256"},"directories":{}},"0.4.1":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.4.1","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.5.0","coffee-coverage":"^1.0.1","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.4.2","mocha":"~2.4.5","pre-commit":"~1.1.1","rimraf":"~2.5.2","shasum":"1.0.0","sinon":"~1.17.3","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"997d3b9b63cbd8eabf573569b06544194ce17423","_id":"abstract-type@0.4.1","_shasum":"4029f228272dcbc806f1688ddc702914e31138ff","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.0","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"4029f228272dcbc806f1688ddc702914e31138ff","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.4.1.tgz","integrity":"sha512-rnnul6kMKVRkjkTK+ARF2+1gXRsu29QbdPI+CCKHrzI1gUem+dComzSABl9Eooard8AwQpUATKuWudDEChWY2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHNladLcrt1hdUXPlFgT4EDghrh7EwfekrmhLa836vl6AiEA5emuLqQQyCpqs8aId6Ty8TpDRpZNqxjg0UUEBgGJxeQ="}]},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/abstract-type-0.4.1.tgz_1456608793581_0.6976767960004508"},"directories":{}},"0.4.2":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.4.2","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.7","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.5.0","coffee-coverage":"^1.0.1","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.4.2","mocha":"~2.4.5","pre-commit":"~1.1.1","rimraf":"~2.5.2","shasum":"1.0.0","sinon":"~1.17.3","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"1acb2455fbec738bc550bd525d21ff072dbca307","_id":"abstract-type@0.4.2","_shasum":"5e053668ea7ff527a2cc74d82387dd95d99dff94","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"5e053668ea7ff527a2cc74d82387dd95d99dff94","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.4.2.tgz","integrity":"sha512-i5klpVTRdjdPvolw62DqJlEHwMqCHuPFYEYb0azoaw+BXVF0SglpYiG68y4gMI7CFK3q+OcnQIhTntASUtaFUQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDaBFFt6eM/pFxtLBCsBuAH7VyNrpllYMMuTLFR6FmsdAiEAlS1MAUedE9jwYFH4yRFBP46fWfJC6/FO0tDbNMwnDeU="}]},"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/abstract-type-0.4.2.tgz_1456647823083_0.5913681001402438"},"directories":{}},"0.4.3":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.4.3","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.12","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.5.0","coffee-coverage":"^1.0.1","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.4.2","mocha":"~2.4.5","pre-commit":"~1.1.1","rimraf":"~2.5.2","shasum":"1.0.0","sinon":"~1.17.3","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"7b7fabf903eb5d81c1dacab04ab01b0ce9b13ee7","_id":"abstract-type@0.4.3","_shasum":"4430daf8e69613b0c516ca6a238e869cda32e05f","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"4430daf8e69613b0c516ca6a238e869cda32e05f","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.4.3.tgz","integrity":"sha512-LMAQfoCeSwlpc8v0kiyeSFOG24nvbCDz0fOQZIERO46nQm0aBN3rAeG6Q8qFgSwWvpSAsJn8J2wHw9lzIFcjdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAr8OcspoEXT95L7U9UZh4zXoI+L7jjde+9Y2eDLw5EsAiEA910/ZZrv4cBQlanZc8/T1l4h3TRJ8WJdp4NEDLHKFUQ="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/abstract-type-0.4.3.tgz_1457167089222_0.05960296746343374"},"directories":{}},"0.4.4":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class and `Value` class for streamable type info and validating value.","version":"0.4.4","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./index","files":["README.md","LICENSE-MIT","*.js","*.coffee","test","src","lib"],"keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"dependencies":{"custom-factory":"^1.5.0","inherits-ex":"^1.1.4","property-manager":"^0.10.12","util-ex":"^0.3.14"},"devDependencies":{"chai":"~3.5.0","coffee-coverage":"^1.0.1","grunt":"~0.4.5","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-watch":"~0.6.1","grunt-mocha-test":"~0.12.6","grunt-newer":"~0.8.0","grunt-release":"~0.9.0","istanbul":"^0.4.2","mocha":"~2.4.5","pre-commit":"~1.1.1","rimraf":"~2.5.2","shasum":"1.0.0","sinon":"~1.17.3","sinon-chai":"~2.8.0"},"scripts":{"test":"grunt test","test-cov":"mocha --reporter dot && istanbul report text-summary lcovonly"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"pre-commit":["test"],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","stability":"unstable","gitHead":"edb831eea4ae73701c8a7f5eea778ff52926aeb3","_id":"abstract-type@0.4.4","_shasum":"7d4df63717f2d4f547327a471415755030fbe536","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"dist":{"shasum":"7d4df63717f2d4f547327a471415755030fbe536","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-0.4.4.tgz","integrity":"sha512-5wbRT3bGQ+FJtiPfa/MGWAmg105719s+ao9YdtcCEGozDTSyhxudo4+NGzcj1L5eJTV4s2NPE4C/z1EFTiMwPg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE3DA+RTsgngkKV3WRKRgqCFTdzxmHYJvIsFJpcvdVvBAiEAtXNP1IOpJWx4jTX0uwovzW9QmrhU1TJWRgWq6XrHxWA="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/abstract-type-0.4.4.tgz_1457272768130_0.5923540284857154"},"directories":{}},"2.0.0-alpha.0":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.0","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.5.3","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for streamable type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Properties:\n    * $attributes *(object)*: the attributes of this type.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\n```coffee\nTypeAttributes    = require 'abstract-type/lib/attributes'\nType              = require 'abstract-type'\nregister          = Type.register\naliases           = Type.aliases\n\nclass NumberType\n  register NumberType\n  aliases NumberType, 'number'\n\n  $attributes: TypeAttributes\n    min:\n      name: 'min'\n      type: 'Number'\n    max:\n      name: 'max'\n      type: 'Number'\n\n  #valueToString: (aValue)->\n  #  aValue = String(aValue)\n  stringToValue: (aString)->\n    if isInt aString\n      aString = parseInt(aString)\n    else if isFloat aString\n      aString = parseFloat(aString)\n    else\n      aString = undefined\n    aString\n  _validate: (aValue, aOptions)->\n    aValue = @stringToValue(aValue) if isString aValue\n    result = isNumber aValue\n    if result\n      if aOptions\n        vMin = aOptions.min\n        vMax = aOptions.max\n        if vMin?\n          result = aValue >= vMin\n          if not result\n            @error \"should be equal or greater than minimum value: \" + vMin\n        if result and vMax?\n          result = aValue <= vMax\n          if not result\n            @error \"should be equal or less than maximum value: \" + vMax\n    result\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"37a47b2b98aa16edc47ade94a955735cb27ccf6a","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.0","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-6EofsgJOAYBrWUc5tWUIwyO64ZZUEjzVU9bMPafZ7bNk4yAXwGR2w2Ir55Hsv3xug+mlCg6ginl1Xg9Y0xRMAg==","shasum":"b0ea31b9aeb0b28e09ee81f0ab1333c34970c9ad","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.0.tgz","fileCount":14,"unpackedSize":94555,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkqHhCRA9TVsSAnZWagAA8PEP/37Lo1kcyiGjs2iORMlk\noQ2DLOUU1RSHeqeXwiVXsWsmVbA2VaRPdNlxNEywgjaQn5ws5yDY3wr1PEsy\nj5X6oFQjTUc5QMcHuV5K5SpmP/VLK2ih128VhqT8Un2abGu/QbD/RV/yVb3a\nsMDLzVrrVMPnABFrr9qeiDpJMt6hMHZKRT5PeKHVmRxft4PBBfICbxyQHKRF\nTXXW628Ls7yhRr6Gj8gtzNFvd3dGrSL5bh06RazGVZUYK1Gpf9urN+ZW7BcT\nrMSV3QKL9ia3rV37dCYrn1TP2XsTRtpfwk3wbcCG/4S9uFAOpvkIXqjJiRYw\nPXKdozlXqhWhHSe8pcn4hCfE2jnm863ZxN2hObyY2rCP3Cw0DJai0u7av0BT\nEYOkxF5fE6IWd3kpOuk9bZ5+3Gfxv74TmyAQEiGF4n3hHl65cSIVJ2iv3Tct\ngenUfez4yiTSEF1IiASTREyc/pAY2Y8B9a3qmLa21abaCMReqWxjs3SHidq+\nanMqxiLwZQ8Lut2pVvZzBenLOhajhDqgqPU0PqCwyG3sjwhR8cewlps4ZW9u\n5w0cuLxu6viCejDNdACUAOjuvng8f2CJo2YeFmnUbOfh6eH1g/cgvWGOAuHv\nr2yjTjxSQNSoACsuncEFTCCkMcRsA3NWG1ekrUv3T/+KrzCEUZ3w53JBZQYx\ndZl/\r\n=M8aK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGwcgBZw81ROig9g6JENlZ9GzMBDdpdldA2ZvT2aPctjAiEAqdCMlHy9bK9ni0tqOI630jhvqqz47GvAFeGm8XBZkUg="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.0_1620222432547_0.5323038583814426"},"_hasShrinkwrap":false},"2.0.0-alpha.1":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.1","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.5.3","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for streamable type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Properties:\n    * $attributes *(object)*: the attributes of this type.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\n```coffee\nTypeAttributes    = require 'abstract-type/lib/attributes'\nType              = require 'abstract-type'\nregister          = Type.register\naliases           = Type.aliases\n\nclass NumberType\n  register NumberType\n  aliases NumberType, 'number'\n\n  $attributes: TypeAttributes\n    min:\n      name: 'min'\n      type: 'Number'\n    max:\n      name: 'max'\n      type: 'Number'\n\n  #valueToString: (aValue)->\n  #  aValue = String(aValue)\n  stringToValue: (aString)->\n    if isInt aString\n      aString = parseInt(aString)\n    else if isFloat aString\n      aString = parseFloat(aString)\n    else\n      aString = undefined\n    aString\n  _validate: (aValue, aOptions)->\n    aValue = @stringToValue(aValue) if isString aValue\n    result = isNumber aValue\n    if result\n      if aOptions\n        vMin = aOptions.min\n        vMax = aOptions.max\n        if vMin?\n          result = aValue >= vMin\n          if not result\n            @error \"should be equal or greater than minimum value: \" + vMin\n        if result and vMax?\n          result = aValue <= vMax\n          if not result\n            @error \"should be equal or less than maximum value: \" + vMax\n    result\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"f7467a52b2af94b6aca1c5c2238cc9677e25c338","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.1","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-BC5vW9ApGRW8XQK9ZObDiUfQBlz6dL126QIDk0u9C0YeU2G6I5rJOekvsu19R+ECVutPVIhFricgkH2gOnTImA==","shasum":"aba814a5c40294b62a7939219486cbceaf15cefc","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.1.tgz","fileCount":16,"unpackedSize":98985,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgk1lNCRA9TVsSAnZWagAATokQAJJrP65apIOH0TCwqdwk\nlrOju0XctWErpahnxBCT8nhSnscuwXr3kOJUF/3rtaIxPYw97zkbHZXNxdBF\n0/E4dTUgo6e9942TAqmZsQrJWUzIWMPozDcVaeVX8eU2J7nlGFTsyQsWkdm7\niSYMO1NeBu5xY8EnVwhgxdulXFOgNs5XZ37UgSLrRFoligXfi2Sd8gh6zEcV\nxe0HZ75HG6UE6651776G+lTk1Y+o6ENotDU5eIJDT5Ym3rEBZSz91OAofrEW\n0hF0RYVp7Dl3MEH4CBN6r5tkmbHcXAu8iBagJnp5CdOgIrCE7Od7DRVqEzMS\n3y6J961n9QLtNOU8jqGgOVSmrD59476WOU1nqnE9sv1ZGJuoKuQscBkVh7cZ\nMVbq1N7KypB4wM3MQ8qCiPmu0Ob2Kayi5CsUtXQ8U1eeOfLI8L8GjTknpuCg\nljzAQAHCmdKZexDkL6+WCt12iLy1k45XQ2V7SGF+I8nFdYdBCYhGFw5zIn2e\nbqiGNQ4i7fSxObWhnnnDJNRvcDUR4XP60XKyU7FUXyFTI+bo+r7Tup9j8yha\nVAfmvrFEU9O21KIC/4YvseMU3GEbMyod7hEvxfXo5CdsSd80dIpoGRkOh3nj\nx42VO7IA+lTBS84pS8I82Y7fjnzuRJknU3fjLxSBd3A2eU5VdlekmGp3CZpV\nq/eL\r\n=fF/D\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGN2jde1UgSZXUCcQ/nQ9u6mFVxfLMmIJBl49ff2T37hAiEAyExLqBovOktASJvpir0QDPk2Ef29jfiGX5m3p316coo="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.1_1620269388554_0.10829015378923779"},"_hasShrinkwrap":false},"2.0.0-alpha.2":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.2","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.0","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for streamable type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Properties:\n    * $attributes *(object)*: the attributes of this type.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\n```coffee\nTypeAttributes    = require 'abstract-type/lib/attributes'\nType              = require 'abstract-type'\nregister          = Type.register\naliases           = Type.aliases\n\nclass NumberType\n  register NumberType\n  aliases NumberType, 'number'\n\n  $attributes: TypeAttributes\n    min:\n      name: 'min'\n      type: 'Number'\n    max:\n      name: 'max'\n      type: 'Number'\n\n  #valueToString: (aValue)->\n  #  aValue = String(aValue)\n  stringToValue: (aString)->\n    if isInt aString\n      aString = parseInt(aString)\n    else if isFloat aString\n      aString = parseFloat(aString)\n    else\n      aString = undefined\n    aString\n  _validate: (aValue, aOptions)->\n    aValue = @stringToValue(aValue) if isString aValue\n    result = isNumber aValue\n    if result\n      if aOptions\n        vMin = aOptions.min\n        vMax = aOptions.max\n        if vMin?\n          result = aValue >= vMin\n          if not result\n            @error \"should be equal or greater than minimum value: \" + vMin\n        if result and vMax?\n          result = aValue <= vMax\n          if not result\n            @error \"should be equal or less than maximum value: \" + vMax\n    result\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"aaccdcd301c83e7d9eeafb1592940bb28a6e4195","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.2","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-U4KnJxUrmDbCrrG63cCQKZCf73nwUmEWWMfDED+7w1UJf5nRmFyCbtSxGFwFaSExnZfwVRhJIfRyqIVsciwmVQ==","shasum":"660c1a9caab196ce464f51566de02a68f0b7320a","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.2.tgz","fileCount":16,"unpackedSize":99134,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglKqjCRA9TVsSAnZWagAAkQ0P/3HBoeFneXBg6B2Vv7sN\nAVTGfnbpQv9M5rgrMVAYc5YCaGFn66lQcrwTAx8QSqvP27+ypeHI+r93BLtS\nT9f++3UrWFoxY1Pryd015dFpyvDsKr6jlop7Tr9XLa87D2XWfKnKRvGi4NbY\nnBh8if6lqKnVbHcYS1q1IHyWM0JOzSu1xL+oKDOUK9eE7XhGXrzSIfW4kapw\nt7/OxkNmqSLKrLv5RCOX7ibEt6I4NfOqDc41nz3EmxOrhsTI9gIZZn0Ca5Fz\n9dHnGkHSlVn4H0R3d/g7MeX1bwjSpee4EFICVENWLICJGB7r6N8BydzV2Hf+\nPydeOMF1+XPGTEDvSSx4E3WOtiiUfyLqdoJWocaxxl1nWGOB0f4ONxb5vEej\nGuIjgaec7p7q+sWA4pUogEPiymlCyr4r74wNi7CrzLsF4S7d9/h1oM8Qpnua\nWQh1GWNDx1oEWuE0GCz7H5XZSsQ0zFgyRgVhsZp9LjfGW/PABTHTyZWEdLpi\nzUQx6CkNgMnYQjf/JfxAEhnTiqNeDdgPcHWoanSGcbOjDoxYR5F0Hj+7OQLG\nrmPYWvRxEVt/sPdgu/pm47IhL5Geve0B6PBjUHZ1/cag7KVry9MXjFCclb+7\n9IzxrbQyyHrmlvTMHgYMmLssVwu37GXM83R+AUHITaAe+mU2sIvBXqWn3839\na5Xx\r\n=iRLg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAeaJC/GT7OGksmNuCZiAP6tN6OMoyj59mFvJPJk4topAiEAqST/u+e1sDUbtKTkNzBleNwbsy6ml3AC6dcv+KciVYE="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.2_1620355746448_0.07459921890194021"},"_hasShrinkwrap":false},"2.0.0-alpha.3":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.3","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.0","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for streamable type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\n```coffee\nTypeAttributes    = require 'abstract-type/lib/attributes'\nType              = require 'abstract-type'\nregister          = Type.register\naliases           = Type.aliases\n\nclass NumberType\n  register NumberType\n  aliases NumberType, 'number'\n\n  $attributes: TypeAttributes\n    min:\n      name: 'min'\n      type: 'Number'\n    max:\n      name: 'max'\n      type: 'Number'\n\n  #valueToString: (aValue)->\n  #  aValue = String(aValue)\n  stringToValue: (aString)->\n    if isInt aString\n      aString = parseInt(aString)\n    else if isFloat aString\n      aString = parseFloat(aString)\n    else\n      aString = undefined\n    aString\n  _validate: (aValue, aOptions)->\n    aValue = @stringToValue(aValue) if isString aValue\n    result = isNumber aValue\n    if result\n      if aOptions\n        vMin = aOptions.min\n        vMax = aOptions.max\n        if vMin?\n          result = aValue >= vMin\n          if not result\n            @error \"should be equal or greater than minimum value: \" + vMin\n        if result and vMax?\n          result = aValue <= vMax\n          if not result\n            @error \"should be equal or less than maximum value: \" + vMax\n    result\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"4d522ed8160eda755d2f77beb26d0faa677bcc46","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.3","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-yjFmtCVzv1kNUsRqISvpy5CjvtqdIXUpb5J85DJ1Pq9YXxtb9UMc26JVGAjuYlM+pVzJm+3mEHUd3VzZQh/Gmg==","shasum":"4efaf34cd2210120a4de3dc39b1130b96d98b125","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.3.tgz","fileCount":16,"unpackedSize":101759,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglOzsCRA9TVsSAnZWagAAWdgQAI5lGvcKwjl2cVw7M9xq\n19Rc4c7Dx/vHof7wpLav+IuYa6B9iXJ+NQaSOREO7kOYLr1mlro4PtrbJ5fk\nyoSHKYdmEtO1lDJaH2sGfDub9CqAm3Sko7k4wrmMeCz7e3gUW3S7uNKBHyeG\nhTsi7OPo5f1I7FOY4QM6b03N5eQw0vV8SN3REzIjgpqYEF+0Z6wRhChwH+PO\nF6hd5fIIzfyp6FQdmlkgUq8ySqtah9f7GVrelEDctAtPx1F9vpXSvs939UK2\nMllPK8qKf83kULFjQmvOQmtgEKEDFSEIX7IuHHPWFSjHAFpRhHeD0JUg3xBU\nA7A+LlkkCtY4ACpkExZv5EPyxpM6gX1dWiB3LsNQQLBw8DSDQRHVAD9VS9JW\nPaHOIATzNL50YVm45/xdLnOkyNWz1vp43fgmtwyKPBtSx4a4XAmKTup2TWoB\nhnQXmKviPiZ3N06+/ObDDkNRr/ocTo4dVE1oMpRlDCX758HoTdd8kCyjFeSb\nZDCeKBss78Yk0TyeJfW1Lx8/h8f5M1tUVGQ6WE8wri4j2ie9bFO7B9exoxis\nmTtzYnXO8YQCxZcxeFRxNqd7tj9DJdUs7xO5mLhcGGwTxy1vVikW2NfBfsxL\nDCXRZR0A3bwM01TH0lfWXBATYklDezi3b3F85JD6HWgVW7VWdzd9lIhqCpk9\nj+Y/\r\n=9LfQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFdxrpDPOGmxVU89iabCm6W+ndP3h7/9YyEvVh0RbKtfAiEA+62YznpLbRHs6c6SSYeZxiYYWdE7lFsoHlVLtoBNwnQ="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.3_1620372716170_0.8090096751426892"},"_hasShrinkwrap":false},"2.0.0-alpha.4":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.4","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.0","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for streamable type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\n```coffee\nTypeAttributes    = require 'abstract-type/lib/attributes'\nType              = require 'abstract-type'\nregister          = Type.register\naliases           = Type.aliases\n\nclass NumberType\n  register NumberType\n  aliases NumberType, 'number'\n\n  $attributes: TypeAttributes\n    min:\n      name: 'min'\n      type: 'Number'\n    max:\n      name: 'max'\n      type: 'Number'\n\n  #valueToString: (aValue)->\n  #  aValue = String(aValue)\n  stringToValue: (aString)->\n    if isInt aString\n      aString = parseInt(aString)\n    else if isFloat aString\n      aString = parseFloat(aString)\n    else\n      aString = undefined\n    aString\n  _validate: (aValue, aOptions)->\n    aValue = @stringToValue(aValue) if isString aValue\n    result = isNumber aValue\n    if result\n      if aOptions\n        vMin = aOptions.min\n        vMax = aOptions.max\n        if vMin?\n          result = aValue >= vMin\n          if not result\n            @error \"should be equal or greater than minimum value: \" + vMin\n        if result and vMax?\n          result = aValue <= vMax\n          if not result\n            @error \"should be equal or less than maximum value: \" + vMax\n    result\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"c1b049664fd7b28b7979cfef459bbc9d3d16850e","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.4","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-gKwGpePxz0sSU5+DfXUnsxdG3Jvmd0K07j10VVqkq2nouG7tINg6NRZ63ysHz3skgC+ifJ19cxzWIEgQDxxlYw==","shasum":"712c441ace9865f7aa084b516a167b0f600ca38e","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.4.tgz","fileCount":16,"unpackedSize":106594,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglS+yCRA9TVsSAnZWagAA9zMP/A8r+WPfALSxeayNfBy6\n8N62qsPDLhKOJ0+j4Oi3H398kBQN87as737n6me6uOAmx/ul5i54qN3QRHKO\nhxPs3ftHBY7/btsHI/TYagEiKZCZJBJGQMgPl8Bkz/3JtF2TOLENWQZGJarB\nz7LUDpn7eM+iaHll8St2Prd9wHPr9p9im4Ogv//TAhd5bDcHiGOC/qB8uPhK\nwilxBq7LR5OyHtnMGs3+k4VTmLyMLHiuUWL/JRonBoaex00CTDtCG1mggjAo\nOzcYY7UIiOzGym+CRBY0KYFyNo7I61HWRnJ1GwdR4r+3Myn8DYcNb7nNefTG\n8pB8JxC9CHTS/WIcyqmJxNSJXJDjzHTyKOluiMvUCbg163oYKq1JLMthtcKV\n9hhFnBnhFD4GZ+Jdb/CA/2GI4ct+WnTIrNn0RrZ3+dVEe+vigDtHClEUfwPU\nN/N/mU84+FMG/vcy0IV9C/jfOc7DxgYrng6+18Jy1nm4MFYmbY1gkEqoH61c\nk5LQnFnpxicndqeoVuAxCuio/qRA/tOB/LK+nqrGgTh/Sy6QjrW7Kmry7TGc\nJfhkTV1/DPrIixYFmw9FfyN/qbyHCOB9fqU3ieD6MKkoejB31RNROyycsw2Z\naRk1IldJijBuR30ArbJuvb5nLrdCW365BQ/IMB6A79I/rZf22FmRn20NsEhe\nPQ6/\r\n=5CcR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID9jH/0hpG5H1hUHVAAaDowlwn6oVwYtPZ+9xn21kOeEAiAy+KZtWBgiXgLuk1cpE+7jSC+zeA4gzu6lVzb0oh+nYQ=="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.4_1620389809573_0.7687298915830254"},"_hasShrinkwrap":false},"2.0.0-alpha.5":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.5","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.0","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for serializing/deserializing type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\nNotes:\n\n* Serialize `Type` Class and instance will not export the default value of attributes\n  * `skipDefault=false` if you wanna export the default value of attributes\n\n```typescript\nimport { Type, register, defineProperties } from 'abstract-type'\n\nexport class NumberType extends Type {\n  static toValue(aValue): number | undefined {\n    if (!isNaN(aValue)) aValue = Number(aValue)\n    else aValue = undefined\n    return aValue\n  }\n\n  declare static min: number | undefined\n  declare static max: number | undefined\n  declare min: number | undefined\n  declare max: number | undefined\n\n  _isValid(value) {\n    return isNumber(value)\n  }\n\n  _validate(aValue, aOptions) {\n    const TheType = this['Class'] || this.constructor\n    if (typeof aValue === 'string') aValue = TheType.toValue(aValue)\n    let result = this._isValid(aValue)\n    if (result) {\n      const vMin = aOptions.min\n      const vMax = aOptions.max\n      if (vMin != null) {\n        result = aValue >= vMin\n        if (!result) {\n          this.error('should be equal or greater than minimum value: ' + vMin)\n        }\n      }\n      if (result && vMax != null) {\n        result = aValue <= vMax\n        if (result) {\n          this.error('should be equal or less than maximum value: ' + vMax)\n        }\n      }\n    }\n    return result\n  }\n}\n\ndefineProperties(NumberType, {\n  min: {\n    type: 'Number',\n  },\n  max: {\n    type: 'Number',\n  },\n})\n\nregister(NumberType)\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"d03aa87bbc3fa76f9bb6afdfae1b56bd04e988a0","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.5","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-NivCdrqDXP3qlEY/bZLyzM3XjHfefXr+NduzktmTl5nYVBWGBvim/Y9Z1hYZ9YFghcDeaFE08I08QuH9C3NwZg==","shasum":"6c52c8a0f8db490bff53263125f236ba556575c9","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.5.tgz","fileCount":16,"unpackedSize":107430,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgleEkCRA9TVsSAnZWagAAsXsP/12o4nenkZNEGDZGxtA9\nupYUFDCTGqDsHAtae61hu2V1+8wuVdeTCTcOmGaqdJYv5LnHWpXs5PoSINND\noVGHYGSgZnktP17NnpWpC+i4/0dcazYxyxf/AHIbk1EKIiPLn/T9yzetpzRl\nMLMsJfOx0vj7mmD6sY7lLEnu51c+kb0tcAFmQe91JaVF7PhbrvvFdqpNVIg/\nkE6HO4VtzssiMLm34Eec09PFY/FFA3qxc1UPVWy2s6CKweUjzThWPrCn3d//\nrTKnBWRE1llfFgVg8RUsgzdDrV3TY5Q8b+oPCFcVTh8Lcu6Fq3YOy+Y63uEh\nutsyATzw1P/uzxjGU5WPvc6SPnld3kVfftMHzxMcrL/nRCxqNf422YB4AcYZ\n7rzl1Uc7xCOmLpnyI9Xli4d8+gHUCotnbeN+DdyhhXQIO5+y+lYRUePc8K0/\nrE0S427GLmNLc+3C/o3i3mPf6YOreb8i+pyYNhgBjfep+8bNkkqE6EKvEfUN\nMoqUjSSCfAJKhzHOspE1ttlQ8cBggwtE5zJ6jk4GfMsCeNHQHts/DJetqyK0\nrFO6MagZk+SpuBbv5yvbaUBxLRPDSgs0EmkfmIPIsGBW7x0/kwcWfjnboq7D\nmvUlr9m6we9dpAjT20hJwdxrIo1ebFlb0h+Opim7/4ny0y7+8d/RGv/idLcJ\n8BsR\r\n=b98N\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCD3w478q6JTH+uFoUp0hrOPkIyABlE2DyWd/ZK1ZxECAIgKT2A4tgfDsNsjKTk1fivCMOm8pp4W//77Hv4gZB96rM="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.5_1620435235501_0.28216460487574446"},"_hasShrinkwrap":false},"2.0.0-alpha.6":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.6","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.0","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for serializing/deserializing type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\nNotes:\n\n* Serialize `Type` Class and instance will not export the default value of attributes\n  * `skipDefault=false` if you wanna export the default value of attributes\n\n```typescript\nimport { Type, register, defineProperties } from 'abstract-type'\n\nexport class NumberType extends Type {\n  static toValue(aValue): number | undefined {\n    if (!isNaN(aValue)) aValue = Number(aValue)\n    else aValue = undefined\n    return aValue\n  }\n\n  declare static min: number | undefined\n  declare static max: number | undefined\n  declare min: number | undefined\n  declare max: number | undefined\n\n  _isValid(value) {\n    return isNumber(value)\n  }\n\n  _validate(aValue, aOptions) {\n    const TheType = this['Class'] || this.constructor\n    if (typeof aValue === 'string') aValue = TheType.toValue(aValue)\n    let result = this._isValid(aValue)\n    if (result) {\n      const vMin = aOptions.min\n      const vMax = aOptions.max\n      if (vMin != null) {\n        result = aValue >= vMin\n        if (!result) {\n          this.error('should be equal or greater than minimum value: ' + vMin)\n        }\n      }\n      if (result && vMax != null) {\n        result = aValue <= vMax\n        if (result) {\n          this.error('should be equal or less than maximum value: ' + vMax)\n        }\n      }\n    }\n    return result\n  }\n}\n\ndefineProperties(NumberType, {\n  min: {\n    type: 'Number',\n  },\n  max: {\n    type: 'Number',\n  },\n})\n\nregister(NumberType)\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"e38c92c5a667a573e4875e034819fc00c45853f6","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.6","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-3Myl7xGufISQRA7uyDkUfjSnHMwxwYBa/scgAgjjOM9TdmEoGGrPG7j+6HZVMB/hxLVW01ei5pLnDc478ud90Q==","shasum":"66f6daa3198345292c9d23e30e0482ba07a6d9ca","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.6.tgz","fileCount":16,"unpackedSize":108477,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglfMoCRA9TVsSAnZWagAA62IP/00EZpx4xOoFkxI9WfLK\nP+VrhdJe2BFk4i4saSV8WPVKVgPFJdKyPe8exPnFmuYgZWsazkmyTjU1+FJr\nt3JnYk4NGSfMd5Gl7Adw+UGNFnaS0ECucyH4QClRHRhfnuckAYjc2m96fGmv\no90FXDcdBXF4CQ6uEfbyXD59Wa/B6X6QN9/ImwnM/yzyeYMovUCkopUxj9AU\nalkPpTixrgydDlSdEocGvhaq0BAF1G8H/1JtqdInOtflgrVUotTXt8nwwAni\n4Jhz4SEhBCI1nt6XyXF8qW40anJvwwSJJODzy0KvOz9VoR06XTYpriylYDh2\nTDghOf/u6A6E/Ka1D/chohIGWXrZQZE9eRk3Q97F5FqjB7gXtUfbKGMqRzDe\nIxx/R1R5iSFkHBS2W6t8ZrEzLjrjwAJYAUNirNqj7DmN7fWkj1QWcrbM0/nO\nGMCfiFv/dk1KDJbiFLIJZd9C6ROeVHaLjPnvbxQNq157NptEXx0sHJPpFtiJ\nqPzJApZJQNN0zyn8K5IFv1hvme4ypIabdlUiVj1UCoW5ChSfjzgqsdztxnwv\nYnewHy2i6Zji3PTYIAsbfxI1gNauXvk3wYjozvM81sfC2Iz/0YxZsd17Emow\nEIJuofp+7D8cYPrRG5Dcj+pbtNlg4TdYyxMQq7MQrO2TXGW/hvExeegXj48J\nB1jJ\r\n=nYy/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDa6LGwRuk83yLFQDltxX9aw6AbsTEbc+kTaDiQEVyzxQIgYxe5RO28gOP5MSovNg8aGWhKhXG1KjSwaUJ34rk14rg="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.6_1620439847938_0.2614995597943648"},"_hasShrinkwrap":false},"2.0.0-alpha.7":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.7","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.0","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for serializing/deserializing type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\nNotes:\n\n* Serialize `Type` Class and instance will not export the default value of attributes\n  * `skipDefault=false` if you wanna export the default value of attributes\n\n```typescript\nimport { Type, register, defineProperties } from 'abstract-type'\n\nexport class NumberType extends Type {\n  static toValue(aValue): number | undefined {\n    if (!isNaN(aValue)) aValue = Number(aValue)\n    else aValue = undefined\n    return aValue\n  }\n\n  declare static min: number | undefined\n  declare static max: number | undefined\n  declare min: number | undefined\n  declare max: number | undefined\n\n  _isValid(value) {\n    return isNumber(value)\n  }\n\n  _validate(aValue, aOptions) {\n    const TheType = this['Class'] || this.constructor\n    if (typeof aValue === 'string') aValue = TheType.toValue(aValue)\n    let result = this._isValid(aValue)\n    if (result) {\n      const vMin = aOptions.min\n      const vMax = aOptions.max\n      if (vMin != null) {\n        result = aValue >= vMin\n        if (!result) {\n          this.error('should be equal or greater than minimum value: ' + vMin)\n        }\n      }\n      if (result && vMax != null) {\n        result = aValue <= vMax\n        if (result) {\n          this.error('should be equal or less than maximum value: ' + vMax)\n        }\n      }\n    }\n    return result\n  }\n}\n\ndefineProperties(NumberType, {\n  min: {\n    type: 'Number',\n  },\n  max: {\n    type: 'Number',\n  },\n})\n\nregister(NumberType)\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"61a732bdbd609272207e008d5817fc4d3b3d2e00","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.7","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-xA4g1A0cwC9LetuIuIr+AyaY8JK4AIb8rje51ezf+Tq/lUfQEOLnjPU9Ust4fVeNjC5q+WU2LK86frNdUE/k8g==","shasum":"dde7bb251abb972d53980a29ba937e4159b6a67f","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.7.tgz","fileCount":16,"unpackedSize":109512,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglg3QCRA9TVsSAnZWagAA860P/AosUUSgGK5zxTbwdvjD\nH2wzxlQ20dYHvPXO74+wE6RP5CTK7XKBFqnjzob2k88ciCwSXIyiCmX4oR5a\nf0aolUrlbV5fwHgFEg91HjKJiFLIng82Y8JXChHLcJrSpmOqxR7xT3R3TP/f\nDRPl+h9Z4JObmRMGt3x9kgc7zqY97LqB94pO3LiB7I4uU6clS7dEO7VFdzw/\nKmDs31NqCxWkoq1k1MdG1cAUY+sldijRp9udrxJXEXwpCzOUpCxFCWDmJb3B\nnOk7PJvu9nkMMXPW9i8t2qvgBv0jaLeznruFmHjL2KTBGHAvFyBgCZQf5ZHF\nmp6YKHFFx5kchIw/0LaYpCtNVX/soxMcuf2BZnQgCre9OICCibPZ406gxBDE\n3JU5orBJCy4/h8AnSwepez+cYPb3T0iVmNzMeGeFH5AQ4zx+vZ1sCvCmG3x5\nhr2m7ruTfA+kM1RyhC1rs7iZGdOJIaLujbjj15QB0UGNDz5tYx9/xx02HDtV\nm3n1Aw2tL4ywBFbazrAIVeO1XgdUiZ32U4GolKfefPKPnSaU6H96Zx077qm0\nUplNMvq+UwJFd7JNXxQzdaL7EEFXx9OReEYDPh2eVbplCv+6Sk5BcwRfJPWi\neKEKYVhQ2iptNpuYJJqhARadkjP2dpytsK2DFXtfzMKSHaO8UOH5cRct38gz\n7BYB\r\n=i05V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCX9mOlbsMHPr08oLyFGms2PPBTRqwXBD963FpxoDcPzQIhAPE3ZBE2szYB/3/rpSf0nKbMtDjNODq30OcDo1yzLflY"}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.7_1620446671827_0.09895005344338292"},"_hasShrinkwrap":false},"2.0.0-alpha.8":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.8","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.24.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.2.1","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.0","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for serializing/deserializing type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\nNotes:\n\n* Serialize `Type` Class and instance will not export the default value of attributes\n  * `skipDefault=false` if you wanna export the default value of attributes\n\n```typescript\nimport { Type, register, defineProperties } from 'abstract-type'\n\nexport class NumberType extends Type {\n  static toValue(aValue): number | undefined {\n    if (!isNaN(aValue)) aValue = Number(aValue)\n    else aValue = undefined\n    return aValue\n  }\n\n  declare static min: number | undefined\n  declare static max: number | undefined\n  declare min: number | undefined\n  declare max: number | undefined\n\n  _isValid(value) {\n    return isNumber(value)\n  }\n\n  _validate(aValue, aOptions) {\n    const TheType = this['Class'] || this.constructor\n    if (typeof aValue === 'string') aValue = TheType.toValue(aValue)\n    let result = this._isValid(aValue)\n    if (result) {\n      const vMin = aOptions.min\n      const vMax = aOptions.max\n      if (vMin != null) {\n        result = aValue >= vMin\n        if (!result) {\n          this.error('should be equal or greater than minimum value: ' + vMin)\n        }\n      }\n      if (result && vMax != null) {\n        result = aValue <= vMax\n        if (result) {\n          this.error('should be equal or less than maximum value: ' + vMax)\n        }\n      }\n    }\n    return result\n  }\n}\n\ndefineProperties(NumberType, {\n  min: {\n    type: 'Number',\n  },\n  max: {\n    type: 'Number',\n  },\n})\n\nregister(NumberType)\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"62c111305f0e41bffad967391e7e3ea570df23dc","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.8","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-HTstqotHqA9pyYeVvC+kKURHkYm065WihnGnTr4uHnJWs69tB39zwDIIPNBxzqz7KX9/LC+U/pV14fXg2lJeCQ==","shasum":"3623f0cefb20f820ca2e8444eab60eccda46e7be","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.8.tgz","fileCount":16,"unpackedSize":115163,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgloG3CRA9TVsSAnZWagAA8UkQAIqoRgpbJTdOuLpM5tz+\n5fDbCYGZhG29wqvbfrRhBwbCkf32psE0YyOTvaIiAodYcWJrRVyEfacnsthT\nREt2BGh0HmgKAF1EnaiNsTrZcvF9ZvdZVK1iRsUqqGipi9UkuAh+jfCSRvKL\nmCot68wBBmsWfJoTUPbCUjCwB+GWZ/8P4oBNFiM6f2jowXIaQCmfKBIVAvN9\n0rjXR4z+KcByMpP7PS0MtaFsvAo4mPw1768Jz/FdeS07DPMBvICQDrOjyvyU\nN3Vrv3OImKk5pPqBWhLctNMLqGf8+8pHWgmmwWcyNkclkpbM4uarwTJGItoi\ncUk9bWgv0Ci7loLFCr+hidYPM2UCVaxzLM9SlpxPF+Dt1MS+ZeWe+7gL1YSt\npHxE65pDcxosg7/dzwlhT2oydOlKugXGhv/1jQJGfA5qAfgBwHW1wz2bONOc\nrlNpCD0sA0eZ7Rluwi14Df3fNGjBDllo3+EzimZzHCvPiL807RFqadS8U/gl\nQhjs9qJPQGWlHiIB9tNDFNkPbw19VRYk84n8rHN4lNeKmov+cHXCHrshuomY\nQhFH35IfNRoRLX0zx2dQNa3LefS5ika4bggIulioWHq7GC7zkNWsUMwoZedX\n2dvZDBnlVW1zzHdXzl/PK3rVX6pGnR4ZhPbvQB0hRSw9tkM3Nok+d0Iipq89\nHxUv\r\n=B0rm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHjD6r/biMDUkmKu+OL/zCSM4zGgKEeANag6tYKexeS1AiAiCZMxoijRMrpKc6ckNsmHN0eVK0aPHw8sQ8vvrLUfIQ=="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.8_1620476342787_0.12457591900977172"},"_hasShrinkwrap":false},"2.0.0-alpha.9":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.9","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.26.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.3.0","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.1","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for serializing/deserializing type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\nNotes:\n\n* Serialize `Type` Class and instance will not export the default value of attributes\n  * `skipDefault=false` if you wanna export the default value of attributes\n\n```typescript\nimport { Type, register, defineProperties } from 'abstract-type'\n\nexport class NumberType extends Type {\n  static toValue(aValue): number | undefined {\n    if (!isNaN(aValue)) aValue = Number(aValue)\n    else aValue = undefined\n    return aValue\n  }\n\n  declare static min: number | undefined\n  declare static max: number | undefined\n  declare min: number | undefined\n  declare max: number | undefined\n\n  _isValid(value) {\n    return isNumber(value)\n  }\n\n  _validate(aValue, aOptions) {\n    const TheType = this['Class'] || this.constructor\n    if (typeof aValue === 'string') aValue = TheType.toValue(aValue)\n    let result = this._isValid(aValue)\n    if (result) {\n      const vMin = aOptions.min\n      const vMax = aOptions.max\n      if (vMin != null) {\n        result = aValue >= vMin\n        if (!result) {\n          this.error('should be equal or greater than minimum value: ' + vMin)\n        }\n      }\n      if (result && vMax != null) {\n        result = aValue <= vMax\n        if (result) {\n          this.error('should be equal or less than maximum value: ' + vMax)\n        }\n      }\n    }\n    return result\n  }\n}\n\ndefineProperties(NumberType, {\n  min: {\n    type: 'Number',\n  },\n  max: {\n    type: 'Number',\n  },\n})\n\nregister(NumberType)\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"4a62a37b089029065f0acb43ff357e445eef44fa","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.9","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-4SCc2QAd01CXsUmIOyCydFJ+VKZXxBKuAVAYZU91G89ExoqWy+0SlQit9FfrZd3p0k8Bc53cKumHfZ3wMpZo9g==","shasum":"d4544a63338d65bf27afc57b430eefb50a4e35a0","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.9.tgz","fileCount":16,"unpackedSize":117113,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmMw+CRA9TVsSAnZWagAANhsP/3a5XKLXL/2dkJjev6Dp\nr/7r+WnWemAeKt0i4Ed6KVH3VkA/pcvLR2GWD8bTqEV0DaOIsn3RSPQDJ2R1\nOPOSFE6ovsxh6L1vWUe5Jc5fBIvFcUF5yGVejAZ5KtoEJJtLyE4lB1SLidkK\nzTPy5klnstrFaVmJXpZcvJB2rY4K8fyAF4M5JtV28JEAmC1T6HDjgeAnc4w2\nRj8vH4atmsSrn5145O/CRosGYa0JS5YU15mmZhNoJkwqJ+sCZgnv3u7KkhjO\n9m8ucwPBEHVj3pZEQjs22xkH4wf2Lxb0+jdkE2TTm4yRLhM5i0+r2qDTWbyx\nE0b6QR+qe9dXwpNoV4HLoJKG7/eJ/lR6Xmvfex6YR477PXhXRQSW9b4SoRIW\nuKhUv2vbFZH3eDd0ItElea3TOcecoXG6v2fdPP92wlModfStSw5DkohdTdw4\nh/MdxTco7cKul4UxukPJj8LtGdDLqHzG2g0dORzrrnidonLD1T0NMk1AwwXN\nnTjyXSlZW0IPkfa+qyKVbGVVehs12kFdjLvGESWuFk9LFjY67qDH/fA2kI/k\nm01FnC80TD5XgWggVBFjLECV4MwVq9+4XCjY/NYNFdX4tbSoapQhsPYpS5IY\n3NBRGzoBzsdjGZATTTQpd2ZRQcDjusxikOCQiYInIgMEmcUUMdWrOtOJKbMU\n28Zu\r\n=ZKLI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCR/gNxSgWZ+9DtfmXEkjETmcYSZiVk9vex9EPSCXuLJgIhALWjSm1Syq/Cfpg/xpHKaB75zxiBrugNdBosQquxKZOU"}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.9_1620626494155_0.6521365115252633"},"_hasShrinkwrap":false},"2.0.0-alpha.10":{"name":"abstract-type","description":"The abstract-type library includes the abstract `Type` class for streamable type info and validating value.","version":"2.0.0-alpha.10","homepage":"https://github.com/snowyu/abstract-type.js","repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"main":"./lib","types":"./types","keywords":["type","information","abstract-type","registry","collection","factory","abstract","class","json"],"license":"MIT","scripts":{"start":"nps","test":"nps test","test-cov":"nps test.cov"},"engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.13.14","@babel/core":"^7.13.15","@babel/eslint-parser":"^7.13.14","@babel/node":"^7.13.13","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.13.15","@babel/plugin-proposal-object-rest-spread":"^7.13.8","@babel/preset-env":"^7.13.15","@babel/preset-typescript":"^7.13.0","@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","babel-jest":"^26.6.3","babel-plugin-module-resolver":"^4.1.0","eslint":"^7.26.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","jest":"^26.6.3","jest-extended":"^0.11.5","nps":"^5.10.0","nps-utils":"^1.7.0","prettier":"^2.3.0","typedoc":"^0.20.36","typedoc-plugin-markdown":"^3.7.2","typescript":"^4.2.4"},"dependencies":{"custom-factory":"^2.1.0-alpha.1","inherits-ex":"^1.3.5","property-manager":"^1.6.1","util-ex":"^0.3.15"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"readme":"# abstract-type [![npm][npm-svg]][npm]\n\n[![Build Status][travis-svg]][travis]\n[![Code Climate][codeclimate-svg]][codeclimate]\n[![Test Coverage][codeclimate-test-svg]][codeclimate-test]\n[![downloads][npm-download-svg]][npm]\n[![license][npm-license-svg]][npm]\n\n[npm]: https://npmjs.org/package/abstract-type\n[npm-svg]: https://img.shields.io/npm/v/abstract-type.svg\n[npm-download-svg]: https://img.shields.io/npm/dm/abstract-type.svg\n[npm-license-svg]: https://img.shields.io/npm/l/abstract-type.svg\n[travis-svg]: https://img.shields.io/travis/snowyu/abstract-type.js/master.svg\n[travis]: http://travis-ci.org/snowyu/abstract-type.js\n[codeclimate-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/gpa.svg\n[codeclimate]: https://codeclimate.com/github/snowyu/abstract-type.js\n[codeclimate-test-svg]: https://codeclimate.com/github/snowyu/abstract-type.js/badges/coverage.svg\n[codeclimate-test]: https://codeclimate.com/github/snowyu/abstract-type.js/coverage\n\nThe abstract-type library includes the abstract `Type` class for serializing/deserializing type info and validating value.\n\n## Concepts\n\n* Primitive Types\n  * All registered types are primitive types.\n  * It's the type class on the global type factory.\n* Type Attributes: the attributes of the type. It's used to constrain the Type.\n  All types have the `name` and `required` attributes.\n  * `name` *(string)*: the type name.\n    * required   = true:  the type name must be required.\n    * enumerable = false: the type name can not be enumerable.\n  * `required` *(boolean)*: the attribute whether is required(must be exists, not optional).\n    default to false.\n  * `value` : the actual value of this type.\n* Virtual Types:\n  * Url, telephone, Positive number\n\n## Usage\n\n### Create the number type\n\nThe type has a name and can verify whether a value belongs to that type, and serialize(deserialize) type and value.\nWe can draw the two concepts related to the type, from here:\n\n* Attributes: the attributes(meta data) of this type.\n* Value: the value of this type.\n\n* The Type Class\n  * Static Members:\n    * Properties:\n      * `$attributes` *(Properties)*: the attributes of this type.\n      * `value`: optional the default value if any\n      * `required` *(Boolean)*: whether it's required(MUST HAVE).\n      * `customValidate` *(value: any, options?)=>boolean*: callback function\n    * Methods:\n      * `getProperties(): PropDescriptors`\n  * Instance Members:\n    * Properties:\n      * `$attributes` *(object)*: the attributes of this type.\n      * `value`: store the value here.\n  * Methods(should be overridden):\n    * `_initialize(aOptions)`: initialize the type object.\n    * `_assign(options)`: assign an options of type to itself.\n    * `_validate(aValue, aOptions)`: validate a value whether is valid.\n    * `valueToString(aValue)`: (optional) convert the value to string, it's used to convert to json.\n    * `toValue(aString)`: (optional) convert the string to the value, it's used to convert from json and assign from value.\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n\n* The Value Class\n  * Properties:\n    * `value`: store the value here.\n    * `$type` *(Type)*: point to the type of this value.\n  * Static/Class Methods:\n    * `tryGetTypeName(Value)`: try to guess the type name of the value.\n    * `constructor(value[, type[, options]])`: create a value instance.\n      * `value`: the assigned value. it will guess the type of the value if no type provided.\n      * `type` *(Type)*: the type of the value\n      * `options` *(object)*: the optional type of value options. it will create a new type if exists.\n  * Methods:\n    * `clone()`: clone this value object.\n    * `assign(value, options)`: assign the value.\n      * `aOptions` *(object)*:\n        * `checkValidity` *(boolean)*: defaults to true.\n    * `fromJson(json)`: assign a value from json string.\n    * `createFromJson(json)`: create a new value object from json string.\n    * `isValid()`: whether the value is valid.\n    * `toObject(aOptions)`: return a parametric object of the value. it wont include type info.\n      unless set the `withType` is true.\n      * aOptions *(object)*:\n        * `withType` *(boolean)*: whether includes the type info. default to false\n  * These methods could be overridden:\n    * `_toObject(aOptions)`: return the parametric object of this value.\n    * `valueOf()`: return the value.\n    * `_assign(value)`: assign the value to itself.\n* The Attributes class: describe the attributes of a type.\n  an attribute could include these properties:\n  * `name` *(string)*: the attribute name. you can specify a non-english name.\n    * the english name(the attributes' key) is used in the internal of the type.\n    * the `name` only used on export(`toObject`) or import(`assign`).\n  * `type` *(string)*: the attribute type.\n  * `enumerable` *(boolean)*: the attribute whether is a hidden attribute, defaults to true.\n    * the hidden attribute can not export to the parametric object(serialized).\n    * note: It's a hidden attribute too if attribute name begins with '$' char.\n  * `required` *(boolean)*: the attribute whether it's required(MUST HAVE).\n  * `value`: the default value of the attribute.\n  * `assign(value, dest, src, key)` *(function)*: optional special function to assign the attribute's `value`\n    from src[`key`] to dest[`key`].\n    * src, dest: the type object or the parametric type object.\n\nNotes:\n\n* Serialize `Type` Class and instance will not export the default value of attributes\n  * `skipDefault=false` if you wanna export the default value of attributes\n\n```typescript\nimport { Type, register, defineProperties } from 'abstract-type'\n\nexport class NumberType extends Type {\n  static toValue(aValue): number | undefined {\n    if (!isNaN(aValue)) aValue = Number(aValue)\n    else aValue = undefined\n    return aValue\n  }\n\n  declare static min: number | undefined\n  declare static max: number | undefined\n  declare min: number | undefined\n  declare max: number | undefined\n\n  _isValid(value) {\n    return isNumber(value)\n  }\n\n  _validate(aValue, aOptions) {\n    const TheType = this['Class'] || this.constructor\n    if (typeof aValue === 'string') aValue = TheType.toValue(aValue)\n    let result = this._isValid(aValue)\n    if (result) {\n      const vMin = aOptions.min\n      const vMax = aOptions.max\n      if (vMin != null) {\n        result = aValue >= vMin\n        if (!result) {\n          this.error('should be equal or greater than minimum value: ' + vMin)\n        }\n      }\n      if (result && vMax != null) {\n        result = aValue <= vMax\n        if (result) {\n          this.error('should be equal or less than maximum value: ' + vMax)\n        }\n      }\n    }\n    return result\n  }\n}\n\ndefineProperties(NumberType, {\n  min: {\n    type: 'Number',\n  },\n  max: {\n    type: 'Number',\n  },\n})\n\nregister(NumberType)\n```\n\n### Use the number type\n\n* Type(aTypeName, aOptions)\n  * get the type info object from glabal cache if aOptions is null\n    or the same as the original/default attributes value.\n  * else create a new virtual type info object.\n* type.createType(aObject) (Type::createType)\n  * create a new type info object instance always.\n  * the aObject.name should be exists as the type name.\n\n```js\nvar cacheable = require('cache-factory')\nvar Type      = cacheable(require('abstract-type')) // apply the cache-able ability to Type\nrequire('number-type') //register the number type to Type.\n\nvar number = Type('Number') // get the number type object.\nassert.equal(number, Type('Number'))\n\nvar num = Type('Number', {min:1, max:6}) // create non-name a virutal type object.\nassert.notEqual(number, num)\n\nvar NumberType = Type.registeredClass('Number') // get Number Type Class\n\n// create a virtual type object\nvar TPositiveNumber = Type('Number', {min:0, cached: 'PositiveNumber'})\n\n\nassert.notOk(TPositiveNumber.isValid(-1))\nassert.ok(TPositiveNumber.isValid(1)) // validate a value\n\nvar n = TPositiveNumber.create(123) // create the value\nn = TPositiveNumber.createValue(123)\nassert.ok(n.isValid())\nassert.equal(Number(n) + 3, 126)\n\n//get the virtual type from cache:\nvar N = Type('/type/AbstractNumber/Number/PositiveNumber')\n//N = NumberType('PositiveNumber')\nassert.equals(N, TPositiveNumber);\n\n```\n\n## API\n\n### Type = require('abstract-type')\n\nIt's the abstract type info class and the type info manager.\n\n* `Type.getType([typeName, ]options)`: get a the type info class from the global factory.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options to apply. different types have different options.\n      * `name` *(string)*: the type name.\n      * `validate` *(function)*: assign the custom validate function.\n        * `function(value)` the first argument is the value to validate.\n          * return the validation result.\n        * stored into the `customValidate` property internal.\n      * `...`: the type's specified options to create a new virtual type object.\n  * __return__\n    * *(object)*: the type object instance.\n  * eg:\n\n  ```js\n  // get the default type object\n  var TNumber = Type('number')\n  // other way to get the default type object\n  TNumber = Type({name: 'number'})\n  // another way to get the default type object\n  TNumber = NumberType()\n  // create a new virtual type object.\n  var TPositiveNumber = Type('number', {min:0})\n  assert.notEqual(TPositiveNumber, TNumber)\n\n  // create a new virtual type object.\n  TPositiveNumber = Type('number', {validate: function(v){return v>=0}})\n  assert.notEqual(TPositiveNumber, TNumber)\n  ```\n\n* `Type.create(typeName, options)`:This class method is used to create a new Type instance object.\n  * __arguments__\n    * `typeName` *(string)*: the type name.\n    * `options` *(object)*: optional type options. different types have different options.\n  * __return__\n    * *(object)*: the created type object instance.\n* `Type.createFrom(aObject)`: the class method to create a type object or value object from a parametric type object.\n  * __arguments__\n    * `aObject` *(object)*: the encoding string should be decoded to an object.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.createFromJson(json)`:the class method to create a type object or value object from a json string.\n  * __arguments__\n    * `json` *(string)*: the json string with type info.\n      * `name` *(string)*: the type name required.\n      * `value` : the optional value. return value object if exists.\n  * __return__\n    * *(object)*:\n      * the created type object instance with the type info if no value in it.\n      * the created value object instance if value in it.\n* `Type.registerValidator(aValidator)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `aValidator` *(object)*: the validator.\n      * `name` *(string)*: the validator option name.\n      * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.registerValidator(name, validate)`:This class method is used to register a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator option name.\n    * `validate` *(function)*: the validator function: `function(value, options)`\n  * __return__\n    * *(boolean)*: whether successful.\n* `Type.unregisterValidator(name)`:This class method is used to unregister a custom validator.\n  * __arguments__\n    * `name` *(string)*: the validator name to unregister.\n  * __return__\n    * *(boolean)*: whether successful.\n* `cloneType()`:the instance method to clone the type object itself.\n  * alias: clone\n  * __return__\n    * *(object)*: the created type object instance with same type info.\n  * eg:\n\n    ```js\n    var num = Type('Number', min:1)\n    var num1 = num.cloneType()\n    assert.ok(num.isSame(num1))\n    ```\n\n* `createType(options)`: create a new the type object of this type with the type options.\n  * __arguments__\n    * `options` *(object)*: optional type options. different types have different options.\n      * it is the same as `cloneType()` if no options\n  * __return__\n    * *(object)*: the created type object instance with the type info options.\n* `createValue(value, options)`:create a value from the type.\n  * alias: create\n  * __arguments__\n    * `value` *(Type)*: the value of this type to create\n    * `options` *(object)*: optional type options\n      * the new virtual type of the value will be created if exists\n  * __return__\n    * *(object)*: the created value object instance.\n* `toObject(aObject, aNameRequired = true)`:convert the type info into aObject(an parametric type object).\n  It could be streamable your type.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n    * `aNameRequired` *(boolean)*: write the name to aObject. defaults to true.\n  * __return__\n    * *(object)*: the created object with type info.\n* `toJson(options)`:convert the type info to a json string. It could be streamable your type.\n  It is almost equivalent to JSON.stringify(theTypeObject).\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `value` *(Type)*: optional value, when value exists, the following options used:\n      * `typeOnly` *(boolean)*: just type info if true. defaults to false.\n  * __return__\n    * *(string)*: the json string with type info.\n* `validate(value, raiseError, options)`:validate a specified value whether is valid.\n  * __arguments__\n    * `value` *(Type)*: the value to validate\n    * `raiseError` *(boolean)*:  whether throw error if validate failed. defaults to true.\n    * `options` *(object)*: optional type options to override. defaults to this type options.\n  * __return__\n    * *(boolean)*: whether is valid if no raise error.\n\n### Value = require('abstract-type').Value\n\nthe value class.\n\nYou should implement the `valueToString(aValue)` and `stringToValue(aString)` method in your derived type class\nto make the value streamable.\n\n\n* `constructor(value[[, type], options])`: create a value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created.\n      * it will guess the type if no type object.\n    * `type` *(Object)*: the optional type object.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* property `$type`: point to a type object. It can not be enumerable.\n* `clone()`: clone the value object.\n  * __return__\n    * *(object)*: the created new value object instance with same as original info.\n* `create(value, options)`:create a new the value object.\n  * __arguments__\n    * `value` *(Type)*: the value to be created. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: the created value object instance.\n* `assign(value, options)`:assign a value to itself.\n  * __arguments__\n    * `value` *(Type)*: the value to be assigned. MUST BE the same type.\n    * `options` *(object)*: optional type options.\n      * checkValidity *(boolean)*: whether check the value is valid. defaults to true.\n  * __return__\n    * *(object)*: `this` object.\n* `isValid()`: validate the value whether is valid.\n  * __return__\n    * *(boolean)*: whether the value is valid.\n* `toObject(options)`:convert the value to an object. It wont include type info via defaults.\n  It could be streamable your value.\n  * __arguments__\n    * `options` *(object)*: optional options\n      * `withType` *(Boolean)*: whether with type info, defaults to false.\n  * __return__\n    * *(object)*: the value and type info(if `withType`).\n  * eg:\n\n    ```js\n    var Type  = require('abstract-type')\n    var Value = Type.Value\n\n    var val = Value(1, Type 'Number')\n\n    assert.equal val.toObject(), 1\n\n    ```\n\n## TODO\n\n+ compare(value1, value2) and equals(value1, value2) to compare value.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"0a3b72f98d289968e97aaa8727e5b65049b49c97","bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"_id":"abstract-type@2.0.0-alpha.10","_nodeVersion":"12.22.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-S6nO3rj+9Sk6YKnREtrE3ziRxZXy/b/Tumtj6iPPJJF4ACtTm1NO+HUHWJxti2bHMNXv7svthRglvacSaaIJ4g==","shasum":"01099bdf9e7052f6c55d618db160497b4fcf5425","tarball":"https://registry.npmjs.org/abstract-type/-/abstract-type-2.0.0-alpha.10.tgz","fileCount":16,"unpackedSize":118211,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmkVkCRA9TVsSAnZWagAAAOwQAIt3N1in5klpl0wd3nFg\nQoJju+umQnMv0BjROHTkJMpH86UJLXJKq0ee5v2jtP5G5ubLyZSuTQOX7ayg\nAN623axemKPznORcS2feCyFBMhmAiRsd8GkoXO87CrTonyuVmZQna/pW5hH2\nbl51QmoU/YNFzZDcT+k2ubqF8Zvi2Hry6E/gsDtkE9Dr2cijhJSkoPXy9q/r\n5tMNylpVmUvN9SiYpKtse1+0O9ozZFdj+rgoH2CisW4Lbc99P7qnv2mNtiWf\nx6TDBVjl1FdxpqmEdD5SdI7bcGM9+EqGQ4NL9LrBl7rHJ9lp1NgebmAjSLwu\nw5CKuguqfW1R6grAhYqrJfqIVu8GhLRZFZq+eC11fGXAuB+0VtSUy33INVFG\nVRJiSlsnUUxrAniYusGyO25wVOAVQdMloWSBGcrj+YvKiD4v3y06gny5OsfG\nEXnTAvMAOLJt7i9BX5ZUAyao4fua5yrDiGHAaCk8xm+zVdAD3cBu9kRH+zAs\nUHQExHoIl+zcUP5DYovpn5y/80qkdCicBy28WeWuHjgREGtJnLHOIoBlaFfh\npAu0518r8+93H4I+IGaaNmKLN4KiK2M8F9xjUcc8amEvCT8KczbyFnSD9MFX\nRn7VNZV76QVzqXyI37Bb1d0cgPhHOS+d28BfRTVgh7PCR00hk7rFX2DcA4Vr\nB8NK\r\n=c4wP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHG9jjtVTzJgjDF7w4qVcWCD8C5r8dMZyeN2R49M7ol5AiAamT0xIeMZCrOTK0wjM+tcK4ci/8bcCFaxkTimbX1zuw=="}]},"_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abstract-type_2.0.0-alpha.10_1620723044230_0.8670344030700294"},"_hasShrinkwrap":false}},"readme":"","maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"time":{"modified":"2022-06-13T02:20:31.999Z","created":"2015-09-26T07:16:13.578Z","0.0.1":"2015-09-26T07:16:13.578Z","0.1.0":"2015-09-26T14:01:30.340Z","0.2.0":"2015-09-28T14:25:07.233Z","0.2.1":"2015-09-30T07:13:23.147Z","0.2.2":"2015-09-30T08:33:29.170Z","0.2.3":"2015-09-30T08:40:37.627Z","0.2.4":"2015-09-30T08:49:08.551Z","0.3.0":"2015-10-01T14:42:29.216Z","0.3.1":"2015-10-04T04:36:46.546Z","0.3.2":"2015-10-05T13:52:15.420Z","0.3.3":"2015-10-06T05:09:13.193Z","0.4.0":"2016-02-26T16:13:23.551Z","0.4.1":"2016-02-27T21:33:14.616Z","0.4.2":"2016-02-28T08:23:45.543Z","0.4.3":"2016-03-05T08:38:10.544Z","0.4.4":"2016-03-06T13:59:29.615Z","2.0.0-alpha.0":"2021-05-05T13:47:12.718Z","2.0.0-alpha.1":"2021-05-06T02:49:48.703Z","2.0.0-alpha.2":"2021-05-07T02:49:06.626Z","2.0.0-alpha.3":"2021-05-07T07:31:56.365Z","2.0.0-alpha.4":"2021-05-07T12:16:49.712Z","2.0.0-alpha.5":"2021-05-08T00:53:55.776Z","2.0.0-alpha.6":"2021-05-08T02:10:48.091Z","2.0.0-alpha.7":"2021-05-08T04:04:31.947Z","2.0.0-alpha.8":"2021-05-08T12:19:02.989Z","2.0.0-alpha.9":"2021-05-10T06:01:34.286Z","2.0.0-alpha.10":"2021-05-11T08:50:44.344Z"},"homepage":"https://github.com/snowyu/abstract-type.js","keywords":["type","infomation","abstract-type","registry","collection","factory","abstract","class","klass"],"repository":{"type":"git","url":"git://github.com/snowyu/abstract-type.js.git"},"contributors":[{"name":"Riceball LEE","email":"snowyu.lee@gmail.com","url":"https://github.com/snowyu"}],"bugs":{"url":"https://github.com/snowyu/abstract-type.js/issues"},"license":"MIT","readmeFilename":""}