Current collected state Current
Observed since 20 Oct, 17:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
0model
Lightweight module for data control
npm -g install 0model
//raw.githack.com/Daeren/0model/master/index.jsGlobal var: zm
var zm = require("0model");
zm(" D ").string().get().trim(); // <-- "D"
zm(" 13.").to.int().it.is.required(); // <-- true
zm({x: 1, y: 2}).to.have("x", "z"); // <-- false
zm({}).it.is.empty(); // <-- true
zm("[1,2]").to.json().get(); // <-- [1, 2]
zm("[1,").to.json().to.string().get(); // <-- ''
zm("[1,").json().string().get(); // <-- ''
zm(5.9).int().str() + 10; // <-- '510'
zm(5.9).to.integer() + " num"; // <-- '5 num'
zm(zm('d0' / 1)).empty(); // <-- true
zm([1, 2, 3]).set(x => x.reduce((a, b) => a + b)).get(console.log);
zm(3.14159).set(x => x.toFixed(0)).str().get(console.log);
zm("hello 2 world").to.string().then.remove(/\d+/).it.is.required();
zm("hello 2 world").to.string().then.remove(/\d+/).get();
zm("hello 2 world").to.string().then.remove(d => d.substr(2)) + "!";
| Attribute | Type | Note |
|---|---|---|
| - | ||
| to, then, is, it | object | this |
| - | ||
| set | function(v) | return: this |
| get | function([callback]) | return: current value |
| - | ||
| lastError | - | |
| value | - | current value |
| [T] | ||
| bool, boolean | function | (true, on, yes, 1) = true |
| str, string | function | (NaN, null, undefined, []) = "" |
| int, integer | function(radix) | |
| float, number | function | |
| - | ||
| date | function | |
| symbol | function | |
| - | ||
| table, hashTable | function(notParse) | |
| array | function(notParse) | |
| json | function | |
| [M] | ||
| remove | function(t) | t: string, regEx (string), function(elem) |
| abs | function | |
| clamp | function(min, max) | |
| [V] | ||
| required | function | false: NaN, [], null, undefined, "", Invalid Date, {} |
| empty | function | true: NaN, [], null, undefined, "", Invalid Date, {} |
| has, have | function(...) | for: string, array, object |
MIT
Download counts and popularity will appear here as the collector receives them.
Declarations describe requirements; they are not a resolved dependency graph.
Source distribution
{
"shasum": "fcb0141df6ee46fffe79a362085872faea0ce3a2",
"tarball": "https://registry.npmjs.org/0model/-/0model-0.4.1.tgz",
"integrity": "sha512-89L9AEjZOqNbHNptNyBoZAi3rYUHUYOPo4FMKl0T3IrBJX8JZEz5/+J7pfeX7XrK0lPVUq+JBtLIWsB+8I7S6Q==",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEQCIACJJgY/Of7G7/4Rx4idwcE0OJIFl51cD09h0Ctm7PTMAiALIl/yz7EftFoVzOQoMwDgJw+8WhrLu/PXo0hOduFeuA=="
}
]
}Observed since 20 Oct, 17:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:12e08980110efba5ceda87df5af71681e6453cefb213c3596ff1b1d5bbf0249f