Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Database on JavaScript
Storing and structuring your application data on JavaScript.
Providing a standard Store Interface and Redis-like API that you can use in wherever.
Loading via script tag:
<script style="text/javascript" src="/path/to/script/min.js">
With node previously installed:
$ npm install min
If you using SeaJS, you can install with spm:
$ spm install iwillwen/min
If you are using component, you can install it with:
$ component install iwillwen/mindb
Or bower?:
$ bower install mindb
Common key-value via such as SET
, GET
, etc.
min.set('foo', 'bar', function(err) {
if (err) {
return console.error(err);
}
min.get('foo', function(err, value) {
if (err) {
return console.error(err);
}
console.log(value); //=> bar
});
});
set
Set the value of a key (key, value[, callback])
setnx
Set the value of a key, only if the key does not exist (key, value[, callback])
setex
Set the value and expiration of a key (key, seconds, value[, callback])
psetex
Set the value and expiration in milliseconds of a key (key, millseconds, value[, callback])
mset
Set multiple keys to multiple values (plainObject[, callback])
msetnx
Set multiple keys to multiple values, only if none of the keys exist (plainObject[, callback])
append
Append a value to a key (key, value[, callback])
get
Get the value of a key (key[, callback])
mget
Get the values of a set of keys (keys[, callback])
getset
Set the value of a key and return its old value (key, value[, callback])
strlen
Get the length of a key (key[, callback])
incr
Increment the integer value of a key by one (key[, callback])
incrby
Increment the integer value of a key by the given amount (key, increment[, callback])
incrbyfloat
Increment the float value of a key by the given amount (key, increment[, callback])
Maybe you can get the way by browsing Redis Commands. XD
Nested Callbacks? Maybe you would prefer Promise:
min.incr('user_id')
.then(function(curr) {
return min.hmset('user-' + curr, {
name: 'Will Wen Gunn',
id: 'iwillwen',
email: 'willwengunn@gmail.com'
});
})
.then(function(key) {
var id = key.substr(5);
return min.sadd('user-msg-' + id, 'WelCome!');
})
.then(function(length) {
// ...
})
.catch(function(err) {
console.log(err);
});
Anymore else? How about MULTI
?
min.multi()
.incr('msg-seq')
.incr('msg-seq')
.incr('msg-seq')
.exec(function(err, results) {
if (err) {
return console.error(err);
}
console.log(results); //=> [ [ 1 ], [ 2 ], [ 3 ] ]
});
SWEET! Let's run to Harmony(ES2015)!
async _ => {
var userId = await min.incr('users:id:seq')
await min.hmset(`user:${userId}`, {
name: 'Will Wen Gunn',
sign: 'iwillwen',
homepage: 'http://lifemap.in'
})
await min.sadd(`user:${userId}:msgs`, 'Welcome')
}
Support multiple databases:
var Min = min.fork();
Min.set('foo', 'bar')
.then(/*...*/)
.catch(/*...*/);
Read the Store Interface Documentation.
Contribution is welcome.There are more than one way to contribute, and I will appreciate any way you choose.
Because of the Alipay donate page service had been stopped so if you want to support our job, please transfer to my Alipay account(willwengunn@gmail.com) manually. Thanks. PayPal is welcome too: willwengunn@gmail.com
We recommend you to use git-flow
to make a patch.
Hint:
$ git flow feature start [featurename]
$ git add .
$ git commit -m 'new feature description'
$ git flow feature finish [featurename]
Copyright (c) 2012-2013 Will Wen Gunn(willwengunn@gmail.com) All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
FAQs
Database on JavaScript
The npm package min receives a total of 22 weekly downloads. As such, min popularity was classified as not popular.
We found that min demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.