micro-storage
Advanced tools
Comparing version 0.0.1 to 0.0.2
/*! | ||
* @ProjectName micro-storage | ||
* @Version 0.0.1 | ||
* @Version 0.0.2 | ||
* @Author lixinliang(https://github.com/lixinliang) | ||
* @Update 2016-09-19 11:35:32 am | ||
* @Update 2016-09-21 11:49:09 pm | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microStorage=t():e.microStorage=t()}(this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t){"use strict";function o(e){return function(t,o){if(0!=arguments.length)return 1==arguments.length?JSON.parse(localStorage.getItem(e+"."+t)).$:(localStorage.setItem(e+"."+t,JSON.stringify({$:o})),o)}}e.exports=o}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microStorage=t():e.microStorage=t()}(this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t){"use strict";function o(e){return function(t,o){if(0!=arguments.length){if(1==arguments.length){var r=JSON.parse(localStorage.getItem(e+"."+t));return r?r.$:r}return localStorage.setItem(e+"."+t,JSON.stringify({$:o})),o}}}e.exports=o}])}); |
{ | ||
"name": "micro-storage", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "(<1kb) A lite localStorage plugin with namespace", | ||
@@ -5,0 +5,0 @@ "main": "dist/micro-storage.min.js", |
@@ -0,2 +1,13 @@ | ||
/** | ||
* A lite localStorage plugin with namespace | ||
* @param {String} namespace namespace | ||
* @return {Function} function | ||
*/ | ||
function microStorage ( namespace ) { | ||
/** | ||
* Get or set value from storage | ||
* @param {String} name key | ||
* @param {AnyType} value value | ||
* @return {AnyType} value | ||
*/ | ||
return function storage ( name, value ) { | ||
@@ -7,3 +18,4 @@ if (arguments.length == 0) { | ||
if (arguments.length == 1) { | ||
return JSON.parse(localStorage.getItem(`${ namespace }.${ name }`)).$; | ||
let result = JSON.parse(localStorage.getItem(`${ namespace }.${ name }`)); | ||
return result ? result.$ : result; | ||
} | ||
@@ -16,3 +28,1 @@ localStorage.setItem(`${ namespace }.${ name }`, JSON.stringify({ $ : value })); | ||
module.exports = microStorage; | ||
// window.microStorage = microStorage; |
@@ -1,1 +0,1 @@ | ||
module.exports = {"micro-storage":"/Users/lixinliang/GitHub/micro-storage/src/entry/micro-storage.js"} | ||
module.exports = {"index":"/Users/lixinliang/GitHub/micro-storage/src/entry/index.js","micro-storage":"/Users/lixinliang/GitHub/micro-storage/src/entry/micro-storage.js"} |
@@ -15,9 +15,10 @@ 'use strict'; | ||
let entry = require('./entry.js'); | ||
let entry = {}; | ||
let alias = {}; | ||
entry[packageJson.name] = require('./entry.js')[packageJson.name]; | ||
module.exports = { | ||
entry : entry, | ||
output : { | ||
// path : './dist/js/', | ||
path : './dist/', | ||
@@ -63,3 +64,2 @@ filename : '[name].min.js', | ||
plugins : [ | ||
// new extractTextPlugin('../css/[name].css'), | ||
new webpack.BannerPlugin(banner), | ||
@@ -66,0 +66,0 @@ new webpack.optimize.UglifyJsPlugin({ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15217
13
299