├── .npmignore ├── .yarnrc.yml ├── .gitignore ├── .codeclimate.yml ├── coverage ├── lcov-report │ ├── favicon.png │ ├── sort-arrow-sprite.png │ ├── prettify.css │ ├── block-navigation.js │ ├── global.d.ts.html │ ├── sismember.ts.html │ ├── rm.ts.html │ ├── flush.ts.html │ ├── smembers.ts.html │ ├── keys.ts.html │ ├── set.ts.html │ ├── getAll.ts.html │ ├── prefix.ts.html │ ├── sorter.js │ ├── srem.ts.html │ ├── base.css │ ├── index.ts.html │ ├── get.ts.html │ ├── sadd.ts.html │ ├── index.html │ └── prettify.js ├── lcov.info ├── clover.xml └── coverage-final.json ├── src ├── global.d.ts ├── sismember.ts ├── rm.ts ├── flush.ts ├── smembers.ts ├── keys.ts ├── getAll.ts ├── set.ts ├── prefix.ts ├── index.ts ├── srem.ts ├── get.ts └── sadd.ts ├── .travis.yml ├── .github └── workflows │ ├── main.yml │ └── publish.yml ├── package.json ├── test ├── rm.test.ts ├── set.test.ts ├── flush.test.ts ├── sets.test.ts ├── prefix.test.ts └── get.test.ts ├── tsconfig.json ├── LICENSE └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | coverage 2 | test 3 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | checksumBehavior: "update" 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | node_modules 4 | dist 5 | coverage 6 | .yarn 7 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | languages: 2 | JavaScript: true 3 | exclude_paths: 4 | - specs/**/* 5 | -------------------------------------------------------------------------------- /coverage/lcov-report/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsironis/lockr/HEAD/coverage/lcov-report/favicon.png -------------------------------------------------------------------------------- /src/global.d.ts: -------------------------------------------------------------------------------- 1 | type Index = { [key: string]: any[] }; 2 | 3 | interface Options { 4 | noPrefix?: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsironis/lockr/HEAD/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 14.17.5 4 | before_script: 5 | - yarn install 6 | script: 7 | - yarn test 8 | - yarn build 9 | -------------------------------------------------------------------------------- /src/sismember.ts: -------------------------------------------------------------------------------- 1 | import smembers from './smembers'; 2 | 3 | export default function sismember(key: string, value: any) { 4 | return smembers(key).indexOf(value) > -1; 5 | } 6 | -------------------------------------------------------------------------------- /src/rm.ts: -------------------------------------------------------------------------------- 1 | import { getPrefixedKey } from './prefix'; 2 | 3 | export default function rm(key: string, options?: Options): void { 4 | const queryKey = getPrefixedKey(key, options); 5 | 6 | return localStorage.removeItem(queryKey); 7 | } 8 | -------------------------------------------------------------------------------- /src/flush.ts: -------------------------------------------------------------------------------- 1 | import keys from './keys'; 2 | import { hasPrefix, getPrefixedKey } from './prefix'; 3 | 4 | export default function flush() { 5 | if (hasPrefix()) { 6 | keys().forEach(key => { 7 | localStorage.removeItem(getPrefixedKey(key)); 8 | }); 9 | } else { 10 | localStorage.clear(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/smembers.ts: -------------------------------------------------------------------------------- 1 | import { getPrefixedKey } from './prefix'; 2 | export default function smembers(key: string, options?: Options): Array { 3 | const queryKey = getPrefixedKey(key, options); 4 | let value; 5 | 6 | const localValue = localStorage.getItem(queryKey); 7 | if (localValue !== null) { 8 | value = JSON.parse(localValue); 9 | } else { 10 | value = null; 11 | } 12 | 13 | return value && value.data ? value.data : []; 14 | } 15 | -------------------------------------------------------------------------------- /src/keys.ts: -------------------------------------------------------------------------------- 1 | import getPrefix, { hasPrefix } from './prefix'; 2 | export default function keys() { 3 | const prefix = getPrefix(); 4 | const keys: Array = []; 5 | const allKeys = Object.keys(localStorage); 6 | 7 | if (!hasPrefix()) { 8 | return allKeys; 9 | } 10 | 11 | allKeys.forEach(function(key) { 12 | if (key.indexOf(prefix) !== -1) { 13 | keys.push(key.replace(prefix, '')); 14 | } 15 | }); 16 | 17 | return keys; 18 | } 19 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - "**" 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - uses: pnpm/action-setup@v2 13 | with: 14 | version: 7 15 | - uses: actions/setup-node@v3 16 | with: 17 | node-version: 16.x 18 | cache: "pnpm" 19 | 20 | - run: pnpm install --frozen-lockfile 21 | - run: pnpm run build 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lockr", 3 | "license": "MIT", 4 | "version": "0.9.0-beta.1", 5 | "main": "dist/index.js", 6 | "module": "dist/index.mjs", 7 | "types": "dist/index.d.ts", 8 | "author": "Dimitris Tsironis", 9 | "scripts": { 10 | "build": "tsup src/index.ts --format cjs,esm --dts", 11 | "lint": "tsc ./src/index.ts" 12 | }, 13 | "devDependencies": { 14 | "@changesets/cli": "^2.26.0", 15 | "tsup": "^6.5.0", 16 | "typescript": "^4.9.4" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/getAll.ts: -------------------------------------------------------------------------------- 1 | import get from './get'; 2 | import { default as getKeys } from './keys'; 3 | 4 | export default function getAll(includeKeys?: boolean) { 5 | const keys = getKeys(); 6 | 7 | if (includeKeys) { 8 | return keys.reduce(function(accum, key) { 9 | const tempObj: Index = {}; 10 | tempObj[key] = get(key); 11 | accum.push(tempObj); 12 | return accum; 13 | }, []); 14 | } 15 | 16 | return keys.map(function(key) { 17 | return get(key); 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /src/set.ts: -------------------------------------------------------------------------------- 1 | import { getPrefixedKey } from './prefix'; 2 | 3 | export default function set(key: string, value: any, options?: Options): void { 4 | var query_key = getPrefixedKey(key, options); 5 | 6 | try { 7 | localStorage.setItem(query_key, JSON.stringify({ data: value })); 8 | } catch (e) { 9 | if (console) { 10 | console.warn( 11 | `Lockr didn't successfully save the '{"${key}": "${value}"}' pair, because the localStorage is full.` 12 | ); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/prefix.ts: -------------------------------------------------------------------------------- 1 | let PREFIX = ''; 2 | export function setPrefix(prefix: string): string { 3 | PREFIX = prefix; 4 | return PREFIX; 5 | } 6 | export function getPrefixedKey(key: string, options?: Options): string { 7 | if (options?.noPrefix === true) { 8 | return key; 9 | } else { 10 | return `${PREFIX}${key}`; 11 | } 12 | } 13 | 14 | export function hasPrefix(): boolean { 15 | return PREFIX.length > 0; 16 | } 17 | 18 | export function getPrefix(): string { 19 | return PREFIX; 20 | } 21 | 22 | export default getPrefix; 23 | -------------------------------------------------------------------------------- /test/rm.test.ts: -------------------------------------------------------------------------------- 1 | import { set, get, sadd, rm, getAll } from '../src'; 2 | 3 | describe('Lockr.rm', function() { 4 | beforeEach(function() { 5 | set('test', 123); 6 | sadd('array', 2); 7 | sadd('array', 3); 8 | set('hash', { "test": 123, "hey": "whatsup" }); 9 | }); 10 | it('removes succesfully a key-value pair', function() { 11 | var oldContents = getAll(); 12 | expect(oldContents.length).toBe(3); 13 | rm('test'); 14 | expect(get('test')).toBeUndefined(); 15 | var contents = getAll(); 16 | expect(contents.length).toBe(2); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import set from './set'; 2 | import sadd from './sadd'; 3 | import smembers from './smembers'; 4 | import rm from './rm'; 5 | import get from './get'; 6 | import getAll from './getAll'; 7 | import flush from './flush'; 8 | import keys from './keys'; 9 | import sismember from './sismember'; 10 | import srem from './srem'; 11 | import { getPrefix, hasPrefix, setPrefix, getPrefixedKey } from './prefix'; 12 | 13 | export { 14 | set, 15 | sadd, 16 | smembers, 17 | rm, 18 | get, 19 | getAll, 20 | flush, 21 | keys, 22 | sismember, 23 | srem, 24 | getPrefixedKey, 25 | getPrefix, 26 | setPrefix, 27 | hasPrefix, 28 | }; 29 | -------------------------------------------------------------------------------- /src/srem.ts: -------------------------------------------------------------------------------- 1 | import { getPrefixedKey } from './prefix'; 2 | import smembers from './smembers'; 3 | 4 | export default function srem(key: string, value: any, options?: Options) { 5 | const queryKey = getPrefixedKey(key, options); 6 | const values = smembers(key, value); 7 | const index = values.indexOf(value); 8 | 9 | if (index > -1) { 10 | values.splice(index, 1); 11 | } 12 | 13 | const json = JSON.stringify({ data: values }); 14 | 15 | try { 16 | localStorage.setItem(queryKey, json); 17 | } catch (e) { 18 | if (console) 19 | console.warn( 20 | "Lockr couldn't remove the " + value + ' from the set ' + key 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /coverage/lcov-report/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /test/set.test.ts: -------------------------------------------------------------------------------- 1 | import { set } from '../src'; 2 | 3 | describe('Lockr#set', () => { 4 | it('saves a key-value pair in the localStorage', () => { 5 | set('test', 123); 6 | expect(localStorage.getItem('test')).toEqual('{"data":123}'); 7 | }); 8 | 9 | it('should save a hash object in the localStorage', function() { 10 | set('my_hash', { test: 123, hey: 'whatsup' }); 11 | 12 | expect(localStorage.getItem('my_hash')).toContain('data'); 13 | expect(localStorage.getItem('my_hash')).toContain('test'); 14 | expect(localStorage.getItem('my_hash')).toContain('123'); 15 | expect(localStorage.getItem('my_hash')).toContain('hey'); 16 | expect(localStorage.getItem('my_hash')).toContain('whatsup'); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 4 | "module": "commonjs", /* Specify what module code is generated. */ 5 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 6 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 7 | "strict": true, /* Enable all strict type-checking options. */ 8 | "skipLibCheck": true, /* Skip type checking all .d.ts files. */ 9 | "noUncheckedIndexedAccess": true, 10 | "noEmit": true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/get.ts: -------------------------------------------------------------------------------- 1 | import { getPrefixedKey } from './prefix'; 2 | 3 | export default function get( 4 | key: string, 5 | missing?: any, 6 | options?: Options 7 | ): any { 8 | const queryKey = getPrefixedKey(key, options); 9 | let value; 10 | 11 | const localValue = localStorage.getItem(queryKey); 12 | try { 13 | if (localValue !== null) { 14 | value = JSON.parse(localValue); 15 | } 16 | } catch (e) { 17 | if (localStorage[queryKey]) { 18 | value = { data: localStorage.getItem(queryKey) }; 19 | } else { 20 | value = null; 21 | } 22 | } 23 | 24 | if (!value) { 25 | return missing; 26 | } else if (typeof value === 'object' && typeof value.data !== 'undefined') { 27 | return value.data; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | on: 3 | push: 4 | branches: 5 | - "main" 6 | 7 | concurrency: ${{ github.workflow }}-${{ github.ref }} 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: pnpm/action-setup@v2 15 | with: 16 | version: 7 17 | - uses: actions/setup-node@v3 18 | with: 19 | node-version: 16.x 20 | cache: "pnpm" 21 | 22 | - run: pnpm install --frozen-lockfile 23 | - name: Create Release Pull Request or Publish 24 | id: changesets 25 | uses: changesets/action@v1 26 | with: 27 | publish: pnpm run build 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | -------------------------------------------------------------------------------- /src/sadd.ts: -------------------------------------------------------------------------------- 1 | import smembers from './smembers'; 2 | import { getPrefixedKey } from './prefix'; 3 | 4 | export default function sadd( 5 | key: string, 6 | value: any, 7 | options?: Options 8 | ): boolean { 9 | const queryKey = getPrefixedKey(key, options); 10 | let json; 11 | 12 | var values = smembers(key); 13 | 14 | if (values.indexOf(value) > -1) { 15 | return false; 16 | } 17 | 18 | try { 19 | values.push(value); 20 | json = JSON.stringify({ data: values }); 21 | localStorage.setItem(queryKey, json); 22 | } catch (e) { 23 | console.log(e); 24 | if (console) 25 | console.warn( 26 | "Lockr didn't successfully add the " + 27 | value + 28 | ' to ' + 29 | key + 30 | ' set, because the localStorage is full.' 31 | ); 32 | } 33 | return true; 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Dimitris Tsironis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/flush.test.ts: -------------------------------------------------------------------------------- 1 | import { set, setPrefix, sadd, getAll, flush } from '../src'; 2 | 3 | describe('Lockr#flush', function() { 4 | it('clears all contents of the localStorage with prefix', function() { 5 | localStorage.setItem('noprefix', 'false'); 6 | set('test', 123); 7 | sadd('array', 2); 8 | sadd('array', 3); 9 | set('hash', { test: 123, hey: 'whatsup' }); 10 | 11 | var oldContents = getAll(); 12 | var keys = Object.keys(localStorage); 13 | 14 | expect(oldContents.length).not.toBe(0); 15 | expect(keys).toContain('noprefix'); 16 | flush(); 17 | expect(keys).toContain('noprefix'); 18 | 19 | var contents = getAll(); 20 | expect(contents.length).toBe(0); 21 | }); 22 | 23 | it('clears all prefixed keys created by Lockr', function() { 24 | setPrefix('example'); 25 | 26 | localStorage.setItem('noprefix', 'false'); 27 | set('test', 123); 28 | sadd('array', 2); 29 | sadd('array', 3); 30 | set('hash', { test: 123, hey: 'whatsup' }); 31 | 32 | var oldContents = getAll(); 33 | var keys = Object.keys(localStorage); 34 | 35 | expect(oldContents.length).not.toBe(0); 36 | expect(keys).toContain('noprefix'); 37 | flush(); 38 | expect(keys).toContain('noprefix'); 39 | 40 | var contents = getAll(); 41 | expect(contents.length).toBe(0); 42 | }); 43 | }); 44 | -------------------------------------------------------------------------------- /test/sets.test.ts: -------------------------------------------------------------------------------- 1 | import sadd from '../src/sadd'; 2 | import sismember from '../src/sismember'; 3 | import smembers from '../src/smembers'; 4 | import srem from '../src/srem'; 5 | 6 | describe('Sets', function() { 7 | beforeEach(function() { 8 | sadd('test_set', 1); 9 | sadd('test_set', 2); 10 | }); 11 | 12 | describe('Lockr#sadd', function() { 13 | it('saves a set under the given key in the localStorage', function() { 14 | sadd('a_set', 1); 15 | sadd('a_set', 2); 16 | 17 | expect(localStorage.getItem('a_set')).toEqual('{"data":[1,2]}'); 18 | }); 19 | 20 | it('does not add the same value again', function() { 21 | sadd('test_set', 1); 22 | sadd('test_set', 2); 23 | sadd('test_set', 1); 24 | 25 | expect(smembers('test_set')).toEqual([1, 2]); 26 | }); 27 | }); 28 | 29 | describe('Lockr#smembers', function() { 30 | it('returns all the values for given key', function() { 31 | expect(smembers('test_set')).toEqual([1, 2]); 32 | }); 33 | }); 34 | 35 | describe('Lockr#sismember', function() { 36 | it('returns true if the value exists in the given set(key)', function() { 37 | expect(sismember('test_set', 1)).toEqual(true); 38 | expect(sismember('test_set', 34)).toEqual(false); 39 | }); 40 | }); 41 | 42 | describe('Lockr#srem', function() { 43 | it('removes value from collection if exists', function() { 44 | srem('test_set', 1); 45 | expect(sismember('test_set', 1)).toEqual(false); 46 | }); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /test/prefix.test.ts: -------------------------------------------------------------------------------- 1 | import { 2 | setPrefix, 3 | keys as getKeys, 4 | getPrefixedKey, 5 | set, 6 | flush, 7 | sadd, 8 | getAll, 9 | } from '../src'; 10 | 11 | describe('Lockr#prefix', function() { 12 | it('should set a prefix', function() { 13 | expect(setPrefix('imaprefix')).toEqual('imaprefix'); 14 | }); 15 | it('should return a correctly prefixed key', function() { 16 | expect(getPrefixedKey('lalala')).toEqual('imaprefixlalala'); 17 | }); 18 | it('should return a non-prefixed key', function() { 19 | expect(getPrefixedKey('lalala', { noPrefix: true })).toEqual('lalala'); 20 | }); 21 | it('should save a key-value pair, prefixed', function() { 22 | set('justlikeyou', true); 23 | expect('imaprefixjustlikeyou' in localStorage).toEqual(true); 24 | }); 25 | it('gets Lockr keys (with prefix)', function() { 26 | flush(); 27 | 28 | localStorage.setItem('zero', '0'); 29 | set('one', 1); 30 | set('two', 2); 31 | set('three', 3); 32 | set('four', 4); 33 | 34 | var keys = getKeys(); 35 | 36 | expect(keys.length).toBe(4); 37 | expect(keys).toMatchObject({}); 38 | }); 39 | 40 | describe('flush', function() { 41 | it('clears all contents of the localStorage with prefix', function() { 42 | localStorage.setItem('noprefix', 'false'); 43 | set('test', 123); 44 | sadd('array', 2); 45 | sadd('array', 3); 46 | set('hash', { test: 123, hey: 'whatsup' }); 47 | 48 | var oldContents = getAll(); 49 | var keys = Object.keys(localStorage); 50 | 51 | expect(oldContents.length).not.toBe(0); 52 | expect(keys).toContain('noprefix'); 53 | flush(); 54 | expect(keys).toContain('noprefix'); 55 | 56 | var contents = getAll(); 57 | expect(contents.length).toBe(0); 58 | }); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /coverage/lcov-report/block-navigation.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | var jumpToCode = (function init() { 3 | // Classes of code we would like to highlight in the file view 4 | var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; 5 | 6 | // Elements to highlight in the file listing view 7 | var fileListingElements = ['td.pct.low']; 8 | 9 | // We don't want to select elements that are direct descendants of another match 10 | var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` 11 | 12 | // Selecter that finds elements on the page to which we can jump 13 | var selector = 14 | fileListingElements.join(', ') + 15 | ', ' + 16 | notSelector + 17 | missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` 18 | 19 | // The NodeList of matching elements 20 | var missingCoverageElements = document.querySelectorAll(selector); 21 | 22 | var currentIndex; 23 | 24 | function toggleClass(index) { 25 | missingCoverageElements 26 | .item(currentIndex) 27 | .classList.remove('highlighted'); 28 | missingCoverageElements.item(index).classList.add('highlighted'); 29 | } 30 | 31 | function makeCurrent(index) { 32 | toggleClass(index); 33 | currentIndex = index; 34 | missingCoverageElements.item(index).scrollIntoView({ 35 | behavior: 'smooth', 36 | block: 'center', 37 | inline: 'center' 38 | }); 39 | } 40 | 41 | function goToPrevious() { 42 | var nextIndex = 0; 43 | if (typeof currentIndex !== 'number' || currentIndex === 0) { 44 | nextIndex = missingCoverageElements.length - 1; 45 | } else if (missingCoverageElements.length > 1) { 46 | nextIndex = currentIndex - 1; 47 | } 48 | 49 | makeCurrent(nextIndex); 50 | } 51 | 52 | function goToNext() { 53 | var nextIndex = 0; 54 | 55 | if ( 56 | typeof currentIndex === 'number' && 57 | currentIndex < missingCoverageElements.length - 1 58 | ) { 59 | nextIndex = currentIndex + 1; 60 | } 61 | 62 | makeCurrent(nextIndex); 63 | } 64 | 65 | return function jump(event) { 66 | switch (event.which) { 67 | case 78: // n 68 | case 74: // j 69 | goToNext(); 70 | break; 71 | case 66: // b 72 | case 75: // k 73 | case 80: // p 74 | goToPrevious(); 75 | break; 76 | } 77 | }; 78 | })(); 79 | window.addEventListener('keydown', jumpToCode); 80 | -------------------------------------------------------------------------------- /test/get.test.ts: -------------------------------------------------------------------------------- 1 | import { set, keys as getKeys, sadd, get, getAll, flush } from '../src'; 2 | 3 | describe('Lockr#get', () => { 4 | beforeEach(function() { 5 | set('test', 123); 6 | sadd('array', 2); 7 | sadd('array', 3); 8 | set('hash', { test: 123, hey: 'whatsup' }); 9 | localStorage.nativemethod = 'NativeMethod'; 10 | set('valueFalse', false); 11 | set('value0', 0); 12 | }); 13 | 14 | afterEach(() => { 15 | flush(); 16 | }); 17 | 18 | it('returns the value for the given key from the localStorage', function() { 19 | var value = get('test'); 20 | 21 | expect(value).toEqual(123); 22 | }); 23 | 24 | it('returns undefined for a non-existent key', function() { 25 | var value = get('something'); 26 | 27 | expect(value).not.toBeNull(); 28 | expect(value).toBeUndefined(); 29 | }); 30 | 31 | it('returns the value for the given key from the localStorage which set by native method', function() { 32 | var value = get('nativemethod'); 33 | 34 | expect(value).toEqual('NativeMethod'); 35 | }); 36 | 37 | it('returns the value for the given key from the localStorage which equals false', function() { 38 | var value = get('valueFalse'); 39 | 40 | expect(value).toEqual(false); 41 | }); 42 | 43 | it('returns the value for the given key from the localStorage which equals 0', function() { 44 | var value = get('value0'); 45 | 46 | expect(value).toEqual(0); 47 | }); 48 | 49 | it('gets Lockr keys', function() { 50 | flush(); 51 | set('one', 1); 52 | set('two', 2); 53 | set('three', 3); 54 | set('four', 4); 55 | 56 | var keys = getKeys(); 57 | 58 | expect(keys.length).toBe(4); 59 | }); 60 | 61 | it('gets all contents of the localStorage', function() { 62 | var contents = getAll(); 63 | 64 | expect(contents.length).toBe(6); 65 | expect(contents).toContainEqual({ test: 123, hey: 'whatsup' }); 66 | expect(contents).toContain(123); 67 | expect(contents).toContainEqual([2, 3]); 68 | }); 69 | 70 | it('gets all contents of the localStorage as Array of dictionaries (key/value)', function() { 71 | var contents = getAll(true); 72 | 73 | expect(contents.length).toBe(6); 74 | expect(contents).toContainEqual({ hash: { test: 123, hey: 'whatsup' } }); 75 | expect(contents).toContainEqual({ test: 123 }); 76 | expect(contents).toContainEqual({ array: [2, 3] }); 77 | }); 78 | 79 | describe('with pre-existing data', function() { 80 | beforeEach(function() { 81 | localStorage.setItem('wrong', ',fluffy,truffly,commas,hell'); 82 | localStorage.setItem('unescaped', 'a " double-quote'); 83 | }); 84 | 85 | it("if it's not a json we get as-is", function() { 86 | var wrongData = get('wrong'); 87 | expect(wrongData).toBe(',fluffy,truffly,commas,hell'); 88 | }); 89 | 90 | it('works with unescaped characters', function() { 91 | var unescaped = get('unescaped'); 92 | expect(unescaped).toBe('a " double-quote'); 93 | }); 94 | }); 95 | }); 96 | -------------------------------------------------------------------------------- /coverage/lcov-report/global.d.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for global.d.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files global.d.ts

23 |
24 | 25 |
26 | 0% 27 | Statements 28 | 0/0 29 |
30 | 31 | 32 |
33 | 0% 34 | Branches 35 | 0/0 36 |
37 | 38 | 39 |
40 | 0% 41 | Functions 42 | 0/0 43 |
44 | 45 | 46 |
47 | 0% 48 | Lines 49 | 0/0 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6  66 |   67 |   68 |   69 |   70 |  
type Index = { [key: string]: any[] };
71 |  
72 | interface Options {
73 |   noPrefix?: boolean;
74 | }
75 |  
76 | 77 |
78 |
79 | 84 | 85 | 86 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /coverage/lcov-report/sismember.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for sismember.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files sismember.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 3/3 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 0/0 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 1/1 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 3/3 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 66x 66 |   67 | 6x 68 | 3x 69 |   70 |  
import smembers from './smembers';
71 |  
72 | export default function sismember(key: string, value: any) {
73 |   return smembers(key).indexOf(value) > -1;
74 | }
75 |  
76 | 77 |
78 |
79 | 84 | 85 | 86 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /coverage/lcov-report/rm.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for rm.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files rm.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 4/4 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 0/0 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 1/1 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 4/4 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 85x 68 |   69 | 5x 70 | 1x 71 |   72 | 1x 73 |   74 |  
import { getPrefixedKey } from './prefix';
 75 |  
 76 | export default function rm(key: string, options?: Options): void {
 77 |   const queryKey = getPrefixedKey(key, options);
 78 |  
 79 |   return localStorage.removeItem(queryKey);
 80 | }
 81 |  
82 | 83 |
84 |
85 | 90 | 91 | 92 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /coverage/lcov-report/flush.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for flush.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files flush.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 7/7 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 2/2 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 2/2 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 7/7 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 135x 73 | 5x 74 |   75 | 5x 76 | 15x 77 | 3x 78 | 11x 79 |   80 |   81 | 12x 82 |   83 |   84 |  
import keys from './keys';
 85 | import { hasPrefix, getPrefixedKey } from './prefix';
 86 |  
 87 | export default function flush() {
 88 |   if (hasPrefix()) {
 89 |     keys().forEach(key => {
 90 |       localStorage.removeItem(getPrefixedKey(key));
 91 |     });
 92 |   } else {
 93 |     localStorage.clear();
 94 |   }
 95 | }
 96 |  
97 | 98 |
99 |
100 | 105 | 106 | 107 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /coverage/lcov.info: -------------------------------------------------------------------------------- 1 | TN: 2 | SF:src/flush.ts 3 | FN:4,flush 4 | FN:6,(anonymous_1) 5 | FNF:2 6 | FNH:2 7 | FNDA:15,flush 8 | FNDA:11,(anonymous_1) 9 | DA:1,5 10 | DA:2,5 11 | DA:4,5 12 | DA:5,15 13 | DA:6,3 14 | DA:7,11 15 | DA:10,12 16 | LF:7 17 | LH:7 18 | BRDA:5,0,0,3 19 | BRDA:5,0,1,12 20 | BRF:2 21 | BRH:2 22 | end_of_record 23 | TN: 24 | SF:src/get.ts 25 | FN:3,get 26 | FNF:1 27 | FNH:1 28 | FNDA:39,get 29 | DA:1,5 30 | DA:3,5 31 | DA:8,39 32 | DA:11,39 33 | DA:12,39 34 | DA:13,39 35 | DA:14,37 36 | DA:17,5 37 | DA:18,5 38 | DA:20,0 39 | DA:24,39 40 | DA:25,3 41 | DA:26,36 42 | DA:27,36 43 | LF:14 44 | LH:13 45 | BRDA:13,0,0,37 46 | BRDA:13,0,1,2 47 | BRDA:17,1,0,5 48 | BRDA:17,1,1,0 49 | BRDA:24,2,0,3 50 | BRDA:24,2,1,36 51 | BRDA:26,3,0,36 52 | BRDA:26,3,1,0 53 | BRDA:26,4,0,36 54 | BRDA:26,4,1,36 55 | BRF:10 56 | BRH:8 57 | end_of_record 58 | TN: 59 | SF:src/getAll.ts 60 | FN:4,getAll 61 | FN:8,(anonymous_1) 62 | FN:16,(anonymous_2) 63 | FNF:3 64 | FNH:3 65 | FNDA:10,getAll 66 | FNDA:6,(anonymous_1) 67 | FNDA:25,(anonymous_2) 68 | DA:1,5 69 | DA:2,5 70 | DA:4,5 71 | DA:5,10 72 | DA:7,10 73 | DA:8,1 74 | DA:9,6 75 | DA:10,6 76 | DA:11,6 77 | DA:12,6 78 | DA:16,9 79 | DA:17,25 80 | LF:12 81 | LH:12 82 | BRDA:7,0,0,1 83 | BRDA:7,0,1,9 84 | BRF:2 85 | BRH:2 86 | end_of_record 87 | TN: 88 | SF:src/global.d.ts 89 | FNF:0 90 | FNH:0 91 | LF:0 92 | LH:0 93 | BRF:0 94 | BRH:0 95 | end_of_record 96 | TN: 97 | SF:src/index.ts 98 | FN:25,(anonymous_0) 99 | FN:27,(anonymous_1) 100 | FN:26,(anonymous_2) 101 | FN:24,(anonymous_3) 102 | FNF:4 103 | FNH:2 104 | FNDA:0,(anonymous_0) 105 | FNDA:0,(anonymous_1) 106 | FNDA:2,(anonymous_2) 107 | FNDA:2,(anonymous_3) 108 | DA:1,5 109 | DA:2,5 110 | DA:3,5 111 | DA:4,5 112 | DA:5,5 113 | DA:6,5 114 | DA:7,5 115 | DA:8,5 116 | DA:9,5 117 | DA:10,5 118 | DA:11,5 119 | DA:14,5 120 | DA:15,5 121 | DA:16,5 122 | DA:17,5 123 | DA:18,5 124 | DA:19,5 125 | DA:20,5 126 | DA:21,5 127 | DA:22,5 128 | DA:23,5 129 | DA:24,7 130 | DA:25,5 131 | DA:26,7 132 | DA:27,5 133 | LF:25 134 | LH:25 135 | BRF:0 136 | BRH:0 137 | end_of_record 138 | TN: 139 | SF:src/keys.ts 140 | FN:2,keys 141 | FN:11,(anonymous_1) 142 | FNF:2 143 | FNH:2 144 | FNDA:15,keys 145 | FNDA:35,(anonymous_1) 146 | DA:1,5 147 | DA:2,5 148 | DA:3,15 149 | DA:4,15 150 | DA:5,15 151 | DA:7,15 152 | DA:8,7 153 | DA:11,8 154 | DA:12,35 155 | DA:13,25 156 | DA:17,8 157 | LF:11 158 | LH:11 159 | BRDA:7,0,0,7 160 | BRDA:7,0,1,8 161 | BRDA:12,1,0,25 162 | BRDA:12,1,1,10 163 | BRF:4 164 | BRH:4 165 | end_of_record 166 | TN: 167 | SF:src/prefix.ts 168 | FN:2,setPrefix 169 | FN:6,getPrefixedKey 170 | FN:14,hasPrefix 171 | FN:18,getPrefix 172 | FNF:4 173 | FNH:4 174 | FNDA:2,setPrefix 175 | FNDA:205,getPrefixedKey 176 | FNDA:30,hasPrefix 177 | FNDA:15,getPrefix 178 | DA:1,6 179 | DA:2,6 180 | DA:3,2 181 | DA:4,2 182 | DA:6,6 183 | DA:7,205 184 | DA:8,1 185 | DA:10,204 186 | DA:14,6 187 | DA:15,30 188 | DA:18,6 189 | DA:19,15 190 | DA:22,6 191 | LF:13 192 | LH:13 193 | BRDA:7,0,0,1 194 | BRDA:7,0,1,204 195 | BRDA:7,1,0,203 196 | BRDA:7,1,1,2 197 | BRDA:7,2,0,205 198 | BRDA:7,2,1,205 199 | BRF:6 200 | BRH:6 201 | end_of_record 202 | TN: 203 | SF:src/rm.ts 204 | FN:3,rm 205 | FNF:1 206 | FNH:1 207 | FNDA:1,rm 208 | DA:1,5 209 | DA:3,5 210 | DA:4,1 211 | DA:6,1 212 | LF:4 213 | LH:4 214 | BRF:0 215 | BRH:0 216 | end_of_record 217 | TN: 218 | SF:src/sadd.ts 219 | FN:4,sadd 220 | FNF:1 221 | FNH:1 222 | FNDA:43,sadd 223 | DA:1,6 224 | DA:2,6 225 | DA:4,6 226 | DA:9,43 227 | DA:12,43 228 | DA:14,43 229 | DA:15,11 230 | DA:18,32 231 | DA:19,32 232 | DA:20,32 233 | DA:21,32 234 | DA:23,0 235 | DA:24,0 236 | DA:25,0 237 | DA:33,32 238 | LF:15 239 | LH:12 240 | BRDA:14,0,0,11 241 | BRDA:14,0,1,32 242 | BRDA:24,1,0,0 243 | BRDA:24,1,1,0 244 | BRF:4 245 | BRH:2 246 | end_of_record 247 | TN: 248 | SF:src/set.ts 249 | FN:4,set 250 | FNF:1 251 | FNH:1 252 | FNDA:59,set 253 | DA:1,5 254 | DA:4,5 255 | DA:5,59 256 | DA:7,59 257 | DA:8,59 258 | DA:10,0 259 | DA:11,0 260 | LF:7 261 | LH:5 262 | BRDA:10,0,0,0 263 | BRDA:10,0,1,0 264 | BRF:2 265 | BRH:0 266 | end_of_record 267 | TN: 268 | SF:src/sismember.ts 269 | FN:3,sismember 270 | FNF:1 271 | FNH:1 272 | FNDA:3,sismember 273 | DA:1,6 274 | DA:3,6 275 | DA:4,3 276 | LF:3 277 | LH:3 278 | BRF:0 279 | BRH:0 280 | end_of_record 281 | TN: 282 | SF:src/smembers.ts 283 | FN:2,smembers 284 | FNF:1 285 | FNH:1 286 | FNDA:49,smembers 287 | DA:1,6 288 | DA:2,6 289 | DA:3,49 290 | DA:6,49 291 | DA:7,49 292 | DA:8,33 293 | DA:10,16 294 | DA:13,49 295 | LF:8 296 | LH:8 297 | BRDA:7,0,0,33 298 | BRDA:7,0,1,16 299 | BRDA:13,1,0,33 300 | BRDA:13,1,1,16 301 | BRDA:13,2,0,49 302 | BRDA:13,2,1,33 303 | BRF:6 304 | BRH:6 305 | end_of_record 306 | TN: 307 | SF:src/srem.ts 308 | FN:4,srem 309 | FNF:1 310 | FNH:1 311 | FNDA:1,srem 312 | DA:1,6 313 | DA:2,6 314 | DA:4,6 315 | DA:5,1 316 | DA:6,1 317 | DA:7,1 318 | DA:9,1 319 | DA:10,1 320 | DA:13,1 321 | DA:15,1 322 | DA:16,1 323 | DA:18,0 324 | DA:19,0 325 | LF:13 326 | LH:11 327 | BRDA:9,0,0,1 328 | BRDA:9,0,1,0 329 | BRDA:18,1,0,0 330 | BRDA:18,1,1,0 331 | BRF:4 332 | BRH:1 333 | end_of_record 334 | -------------------------------------------------------------------------------- /coverage/lcov-report/smembers.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for smembers.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files smembers.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 8/8 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 6/6 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 1/1 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 8/8 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 156x 75 | 6x 76 | 49x 77 |   78 |   79 | 49x 80 | 49x 81 | 33x 82 |   83 | 16x 84 |   85 |   86 | 49x 87 |   88 |  
import { getPrefixedKey } from './prefix';
 89 | export default function smembers(key: string, options?: Options): Array<any> {
 90 |   const queryKey = getPrefixedKey(key, options);
 91 |   let value;
 92 |  
 93 |   const localValue = localStorage.getItem(queryKey);
 94 |   if (localValue !== null) {
 95 |     value = JSON.parse(localValue);
 96 |   } else {
 97 |     value = null;
 98 |   }
 99 |  
100 |   return value && value.data ? value.data : [];
101 | }
102 |  
103 | 104 |
105 |
106 | 111 | 112 | 113 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Lockr logo](http://i.imgur.com/m5kPjkB.png) 2 | 3 | > A minimal API wrapper for localStorage. Simple as your high-school locker. 4 | 5 | [![Build Status](https://travis-ci.org/tsironis/lockr.svg?branch=master)](https://travis-ci.org/tsironis/lockr) 6 | [![npm version](https://badge.fury.io/js/lockr.svg)](http://badge.fury.io/js/lockr) 7 | [![CodeClimate](https://codeclimate.com/github/tsironis/lockr/badges/gpa.svg)](https://codeclimate.com/github/tsironis/lockr) 8 | [![Dependencies](https://david-dm.org/tsironis/lockr.svg?theme=shields.io)](https://david-dm.org/tsironis/lockr) 9 | [![devDependency Status](https://david-dm.org/tsironis/lockr/dev-status.svg)](https://david-dm.org/tsironis/lockr#info=devDependencies) 10 | 11 | Lockr (pronounced /ˈlɒkəʳ/) is an extremely lightweight library (<2kb when minified), designed to facilitate how you interact with localStorage. Saving objects and arrays, numbers or other data types, accessible via a Redis-like API, heavily inspired by [node_redis](https://github.com/mranney/node_redis/). 12 | 13 | ## How to use lockr 14 | 15 | In order to user lockr, you firstly need to install it in your project. 16 | 17 | ```js 18 | npm install lockr --save 19 | ``` 20 | 21 | or maybe download it manually from [JSDelivr](https://www.jsdelivr.com/package/npm/lockr) and hook it in your HTML. 22 | 23 | ## API reference 24 | 25 | 26 | ```Lockr.prefix``` - String 27 | 28 | > Set a prefix to a string value that is going to be prepended to each key saved by Lockr. 29 | 30 | *Example* 31 | 32 | ```js 33 | Lockr.prefix = 'lockr_'; 34 | Lockr.set('username', 'Coyote'); // Saved as string 35 | localStorage.getItem('username'); 36 | > null 37 | localStorage.getItem('lockr_username'); 38 | > {"data":"Coyote"} 39 | ``` 40 | *Please note that* when prefix is set, ```flush``` method deletes only keys that are prefixed, and ignores the rest. 41 | 42 | --- 43 | 44 | ```Lockr.set``` - arguments: *[ key, value ]* {String, Number, Array or Object} 45 | 46 | > Set a key to a particular value or a hash object (```Object``` or ```Array```) under a hash key. 47 | 48 | *Example* 49 | 50 | ```js 51 | Lockr.set('username', 'Coyote'); // Saved as string 52 | Lockr.set('user_id', 12345); // Saved as number 53 | Lockr.set('users', [{name: 'John Doe', age: 18}, {name: 'Jane Doe', age: 19}]); 54 | ``` 55 | 56 | --- 57 | 58 | ```Lockr.get``` - arguments: *[ key or hash_key, default value ]* 59 | 60 | > Returns the saved value for given key, even if the saved value is hash object. If value is null or undefined it returns a default value. 61 | 62 | *Example* 63 | ```js 64 | Lockr.get('username'); 65 | > "Coyote" 66 | 67 | Lockr.get('user_id'); 68 | > 12345 69 | 70 | Lockr.get('users'); 71 | > [{name: 'John Doe', age: 18}, {name: 'Jane Doe', age: 19}] 72 | 73 | Lockr.get('score', 0): 74 | > 0 75 | 76 | Lockr.set('score', 3): 77 | Lockr.get('score', 0): 78 | > 3 79 | ``` 80 | 81 | --- 82 | 83 | ```Lockr.rm``` - arguments: *[ key ]* {String} 84 | 85 | > Remove a key from ```localStorage``` entirely. 86 | 87 | *Example* 88 | 89 | ```js 90 | Lockr.set('username', 'Coyote'); // Saved as string 91 | Lockr.get('username'); 92 | > "Coyote" 93 | Lockr.rm('username'); 94 | Lockr.get('username'); 95 | > undefined 96 | ``` 97 | 98 | --- 99 | 100 | ```Lockr.sadd``` - arguments *[ key, value ]*{String, Number, Array or Object} 101 | 102 | > Adds a unique value to a particular set under a hash key. 103 | 104 | *Example* 105 | 106 | ```js 107 | Lockr.sadd("wat", 1); // [1] 108 | Lockr.sadd("wat", 2); // [1, 2] 109 | Lockr.sadd("wat", 1); // [1, 2] 110 | ``` 111 | 112 | --- 113 | 114 | ```Lockr.smembers``` - arguments *[ key ]* 115 | 116 | > Returns the values of a particular set under a hash key. 117 | 118 | *Example* 119 | 120 | ```js 121 | Lockr.sadd("wat", 42); 122 | Lockr.sadd("wat", 1337); 123 | Lockr.smembers("wat"); // [42, 1337] 124 | ``` 125 | 126 | --- 127 | 128 | ```Lockr.sismember``` - arguments *[ key, value ]* 129 | 130 | > Returns whether the value exists in a particular set under a hash key. 131 | 132 | *Example* 133 | 134 | ```js 135 | Lockr.sadd("wat", 1); 136 | Lockr.sismember("wat", 1); // true 137 | Lockr.sismember("wat", 2); // false 138 | ``` 139 | 140 | --- 141 | 142 | ```Lockr.srem``` - arguments *[ key, value ]* 143 | 144 | > Removes a value from a particular set under a hash key. 145 | 146 | *Example* 147 | 148 | ```js 149 | Lockr.sadd("wat", 1); 150 | Lockr.sadd("wat", 2); 151 | Lockr.srem("wat", 1); 152 | Lockr.smembers("wat"); // [2] 153 | ``` 154 | 155 | --- 156 | 157 | ```Lockr.getAll``` - arguments: *null* 158 | 159 | > Returns all saved values & objects, in an ```Array``` 160 | 161 | *Example* 162 | 163 | ```js 164 | Lockr.getAll(); 165 | > ["Coyote", 12345, [{name: 'John Doe', age: 18}, {name: 'Jane Doe', age: 19}]] 166 | ``` 167 | 168 | ```Lockr.getAll``` - arguments: *[includeKeys] {Boolean}* 169 | 170 | > Returns contents of `localStorage` as an Array of dictionaries that contain key and value of the saved item. 171 | 172 | *Example* 173 | 174 | ```js 175 | Lockr.getAll(true); 176 | > [{"username": "Coyote"}, {"user_id": 12345}, {"users": [{name: 'John Doe', age: 18}, {name: 'Jane Doe', age: 19}]}] 177 | ``` 178 | --- 179 | 180 | ```Lockr.flush()``` - arguments: *null* 181 | 182 | > Empties localStorage(). 183 | 184 | *Example* 185 | 186 | ```js 187 | localStorage.length; 188 | > 3 189 | Lockr.flush(); 190 | localStorage.length; 191 | > 0 192 | ``` 193 | -------------------------------------------------------------------------------- /coverage/lcov-report/keys.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for keys.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files keys.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 11/11 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 4/4 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 2/2 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 11/11 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 17 77 | 18 78 | 195x 79 | 5x 80 | 15x 81 | 15x 82 | 15x 83 |   84 | 15x 85 | 7x 86 |   87 |   88 | 8x 89 | 35x 90 | 25x 91 |   92 |   93 |   94 | 8x 95 |   96 |  
import getPrefix, { hasPrefix } from './prefix';
 97 | export default function keys() {
 98 |   const prefix = getPrefix();
 99 |   const keys: Array<any> = [];
100 |   const allKeys = Object.keys(localStorage);
101 |  
102 |   if (!hasPrefix()) {
103 |     return allKeys;
104 |   }
105 |  
106 |   allKeys.forEach(function(key) {
107 |     if (key.indexOf(prefix) !== -1) {
108 |       keys.push(key.replace(prefix, ''));
109 |     }
110 |   });
111 |  
112 |   return keys;
113 | }
114 |  
115 | 116 |
117 |
118 | 123 | 124 | 125 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /coverage/lcov-report/set.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for set.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files set.ts

23 |
24 | 25 |
26 | 71.43% 27 | Statements 28 | 5/7 29 |
30 | 31 | 32 |
33 | 0% 34 | Branches 35 | 0/2 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 1/1 43 |
44 | 45 | 46 |
47 | 71.43% 48 | Lines 49 | 5/7 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 175x 77 |   78 |   79 | 5x 80 | 59x 81 |   82 | 59x 83 | 59x 84 |   85 |   86 |   87 |   88 |   89 |   90 |   91 |   92 |  
import { getPrefixedKey } from './prefix';
 93 |  
 94 | type Options = any;
 95 | export default function set(key: string, value: any, options?: Options): void {
 96 |   var query_key = getPrefixedKey(key, options);
 97 |  
 98 |   try {
 99 |     localStorage.setItem(query_key, JSON.stringify({ data: value }));
100 |   } catch (e) {
101 |     if (console) {
102 |       console.warn(
103 |         `Lockr didn't successfully save the '{"${key}": "${value}"}' pair, because the localStorage is full.`
104 |       );
105 |     }
106 |   }
107 | }
108 |  
109 | 110 |
111 |
112 | 117 | 118 | 119 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /coverage/lcov-report/getAll.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for getAll.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files getAll.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 12/12 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 2/2 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 3/3 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 12/12 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 17 77 | 18 78 | 19 79 | 205x 80 | 5x 81 |   82 | 5x 83 | 10x 84 |   85 | 10x 86 | 1x 87 | 6x 88 | 6x 89 | 6x 90 | 6x 91 |   92 |   93 |   94 | 9x 95 | 25x 96 |   97 |   98 |  
import get from './get';
 99 | import { default as getKeys } from './keys';
100 |  
101 | export default function getAll(includeKeys?: boolean) {
102 |   const keys = getKeys();
103 |  
104 |   if (includeKeys) {
105 |     return keys.reduce(function(accum, key) {
106 |       const tempObj: Index = {};
107 |       tempObj[key] = get(key);
108 |       accum.push(tempObj);
109 |       return accum;
110 |     }, []);
111 |   }
112 |  
113 |   return keys.map(function(key) {
114 |     return get(key);
115 |   });
116 | }
117 |  
118 | 119 |
120 |
121 | 126 | 127 | 128 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /coverage/lcov-report/prefix.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for prefix.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files prefix.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 13/13 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 6/6 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 4/4 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 13/13 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 17 77 | 18 78 | 19 79 | 20 80 | 21 81 | 22 82 | 236x 83 | 6x 84 | 2x 85 | 2x 86 |   87 | 6x 88 | 205x 89 | 1x 90 |   91 | 204x 92 |   93 |   94 |   95 | 6x 96 | 30x 97 |   98 |   99 | 6x 100 | 15x 101 |   102 |   103 | 6x 104 |  
let PREFIX = '';
105 | export function setPrefix(prefix: string): string {
106 |   PREFIX = prefix;
107 |   return PREFIX;
108 | }
109 | export function getPrefixedKey(key: string, options?: Options): string {
110 |   if (options?.noPrefix === true) {
111 |     return key;
112 |   } else {
113 |     return `${PREFIX}${key}`;
114 |   }
115 | }
116 |  
117 | export function hasPrefix(): boolean {
118 |   return PREFIX.length > 0;
119 | }
120 |  
121 | export function getPrefix(): string {
122 |   return PREFIX;
123 | }
124 |  
125 | export default getPrefix;
126 |  
127 | 128 |
129 |
130 | 135 | 136 | 137 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /coverage/lcov-report/sorter.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | var addSorting = (function() { 3 | 'use strict'; 4 | var cols, 5 | currentSort = { 6 | index: 0, 7 | desc: false 8 | }; 9 | 10 | // returns the summary table element 11 | function getTable() { 12 | return document.querySelector('.coverage-summary'); 13 | } 14 | // returns the thead element of the summary table 15 | function getTableHeader() { 16 | return getTable().querySelector('thead tr'); 17 | } 18 | // returns the tbody element of the summary table 19 | function getTableBody() { 20 | return getTable().querySelector('tbody'); 21 | } 22 | // returns the th element for nth column 23 | function getNthColumn(n) { 24 | return getTableHeader().querySelectorAll('th')[n]; 25 | } 26 | 27 | // loads all columns 28 | function loadColumns() { 29 | var colNodes = getTableHeader().querySelectorAll('th'), 30 | colNode, 31 | cols = [], 32 | col, 33 | i; 34 | 35 | for (i = 0; i < colNodes.length; i += 1) { 36 | colNode = colNodes[i]; 37 | col = { 38 | key: colNode.getAttribute('data-col'), 39 | sortable: !colNode.getAttribute('data-nosort'), 40 | type: colNode.getAttribute('data-type') || 'string' 41 | }; 42 | cols.push(col); 43 | if (col.sortable) { 44 | col.defaultDescSort = col.type === 'number'; 45 | colNode.innerHTML = 46 | colNode.innerHTML + ''; 47 | } 48 | } 49 | return cols; 50 | } 51 | // attaches a data attribute to every tr element with an object 52 | // of data values keyed by column name 53 | function loadRowData(tableRow) { 54 | var tableCols = tableRow.querySelectorAll('td'), 55 | colNode, 56 | col, 57 | data = {}, 58 | i, 59 | val; 60 | for (i = 0; i < tableCols.length; i += 1) { 61 | colNode = tableCols[i]; 62 | col = cols[i]; 63 | val = colNode.getAttribute('data-value'); 64 | if (col.type === 'number') { 65 | val = Number(val); 66 | } 67 | data[col.key] = val; 68 | } 69 | return data; 70 | } 71 | // loads all row data 72 | function loadData() { 73 | var rows = getTableBody().querySelectorAll('tr'), 74 | i; 75 | 76 | for (i = 0; i < rows.length; i += 1) { 77 | rows[i].data = loadRowData(rows[i]); 78 | } 79 | } 80 | // sorts the table using the data for the ith column 81 | function sortByIndex(index, desc) { 82 | var key = cols[index].key, 83 | sorter = function(a, b) { 84 | a = a.data[key]; 85 | b = b.data[key]; 86 | return a < b ? -1 : a > b ? 1 : 0; 87 | }, 88 | finalSorter = sorter, 89 | tableBody = document.querySelector('.coverage-summary tbody'), 90 | rowNodes = tableBody.querySelectorAll('tr'), 91 | rows = [], 92 | i; 93 | 94 | if (desc) { 95 | finalSorter = function(a, b) { 96 | return -1 * sorter(a, b); 97 | }; 98 | } 99 | 100 | for (i = 0; i < rowNodes.length; i += 1) { 101 | rows.push(rowNodes[i]); 102 | tableBody.removeChild(rowNodes[i]); 103 | } 104 | 105 | rows.sort(finalSorter); 106 | 107 | for (i = 0; i < rows.length; i += 1) { 108 | tableBody.appendChild(rows[i]); 109 | } 110 | } 111 | // removes sort indicators for current column being sorted 112 | function removeSortIndicators() { 113 | var col = getNthColumn(currentSort.index), 114 | cls = col.className; 115 | 116 | cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); 117 | col.className = cls; 118 | } 119 | // adds sort indicators for current column being sorted 120 | function addSortIndicators() { 121 | getNthColumn(currentSort.index).className += currentSort.desc 122 | ? ' sorted-desc' 123 | : ' sorted'; 124 | } 125 | // adds event listeners for all sorter widgets 126 | function enableUI() { 127 | var i, 128 | el, 129 | ithSorter = function ithSorter(i) { 130 | var col = cols[i]; 131 | 132 | return function() { 133 | var desc = col.defaultDescSort; 134 | 135 | if (currentSort.index === i) { 136 | desc = !currentSort.desc; 137 | } 138 | sortByIndex(i, desc); 139 | removeSortIndicators(); 140 | currentSort.index = i; 141 | currentSort.desc = desc; 142 | addSortIndicators(); 143 | }; 144 | }; 145 | for (i = 0; i < cols.length; i += 1) { 146 | if (cols[i].sortable) { 147 | // add the click event handler on the th so users 148 | // dont have to click on those tiny arrows 149 | el = getNthColumn(i).querySelector('.sorter').parentElement; 150 | if (el.addEventListener) { 151 | el.addEventListener('click', ithSorter(i)); 152 | } else { 153 | el.attachEvent('onclick', ithSorter(i)); 154 | } 155 | } 156 | } 157 | } 158 | // adds sorting functionality to the UI 159 | return function() { 160 | if (!getTable()) { 161 | return; 162 | } 163 | cols = loadColumns(); 164 | loadData(); 165 | addSortIndicators(); 166 | enableUI(); 167 | }; 168 | })(); 169 | 170 | window.addEventListener('load', addSorting); 171 | -------------------------------------------------------------------------------- /coverage/lcov-report/srem.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for srem.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files srem.ts

23 |
24 | 25 |
26 | 84.62% 27 | Statements 28 | 11/13 29 |
30 | 31 | 32 |
33 | 25% 34 | Branches 35 | 1/4 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 1/1 43 |
44 | 45 | 46 |
47 | 84.62% 48 | Lines 49 | 11/13 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 17 77 | 18 78 | 19 79 | 20 80 | 21 81 | 22 82 | 23 83 | 246x 84 | 6x 85 |   86 | 6x 87 | 1x 88 | 1x 89 | 1x 90 |   91 | 1x 92 | 1x 93 |   94 |   95 | 1x 96 |   97 | 1x 98 | 1x 99 |   100 |   101 |   102 |   103 |   104 |   105 |   106 |  
import { getPrefixedKey } from './prefix';
107 | import smembers from './smembers';
108 |  
109 | export default function srem(key: string, value: any, options?: Options) {
110 |   const queryKey = getPrefixedKey(key, options);
111 |   const values = smembers(key, value);
112 |   const index = values.indexOf(value);
113 |  
114 |   Eif (index > -1) {
115 |     values.splice(index, 1);
116 |   }
117 |  
118 |   const json = JSON.stringify({ data: values });
119 |  
120 |   try {
121 |     localStorage.setItem(queryKey, json);
122 |   } catch (e) {
123 |     if (console)
124 |       console.warn(
125 |         "Lockr couldn't remove the " + value + ' from the set ' + key
126 |       );
127 |   }
128 | }
129 |  
130 | 131 |
132 |
133 | 138 | 139 | 140 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /coverage/lcov-report/base.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin:0; padding: 0; 3 | height: 100%; 4 | } 5 | body { 6 | font-family: Helvetica Neue, Helvetica, Arial; 7 | font-size: 14px; 8 | color:#333; 9 | } 10 | .small { font-size: 12px; } 11 | *, *:after, *:before { 12 | -webkit-box-sizing:border-box; 13 | -moz-box-sizing:border-box; 14 | box-sizing:border-box; 15 | } 16 | h1 { font-size: 20px; margin: 0;} 17 | h2 { font-size: 14px; } 18 | pre { 19 | font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; 20 | margin: 0; 21 | padding: 0; 22 | -moz-tab-size: 2; 23 | -o-tab-size: 2; 24 | tab-size: 2; 25 | } 26 | a { color:#0074D9; text-decoration:none; } 27 | a:hover { text-decoration:underline; } 28 | .strong { font-weight: bold; } 29 | .space-top1 { padding: 10px 0 0 0; } 30 | .pad2y { padding: 20px 0; } 31 | .pad1y { padding: 10px 0; } 32 | .pad2x { padding: 0 20px; } 33 | .pad2 { padding: 20px; } 34 | .pad1 { padding: 10px; } 35 | .space-left2 { padding-left:55px; } 36 | .space-right2 { padding-right:20px; } 37 | .center { text-align:center; } 38 | .clearfix { display:block; } 39 | .clearfix:after { 40 | content:''; 41 | display:block; 42 | height:0; 43 | clear:both; 44 | visibility:hidden; 45 | } 46 | .fl { float: left; } 47 | @media only screen and (max-width:640px) { 48 | .col3 { width:100%; max-width:100%; } 49 | .hide-mobile { display:none!important; } 50 | } 51 | 52 | .quiet { 53 | color: #7f7f7f; 54 | color: rgba(0,0,0,0.5); 55 | } 56 | .quiet a { opacity: 0.7; } 57 | 58 | .fraction { 59 | font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; 60 | font-size: 10px; 61 | color: #555; 62 | background: #E8E8E8; 63 | padding: 4px 5px; 64 | border-radius: 3px; 65 | vertical-align: middle; 66 | } 67 | 68 | div.path a:link, div.path a:visited { color: #333; } 69 | table.coverage { 70 | border-collapse: collapse; 71 | margin: 10px 0 0 0; 72 | padding: 0; 73 | } 74 | 75 | table.coverage td { 76 | margin: 0; 77 | padding: 0; 78 | vertical-align: top; 79 | } 80 | table.coverage td.line-count { 81 | text-align: right; 82 | padding: 0 5px 0 20px; 83 | } 84 | table.coverage td.line-coverage { 85 | text-align: right; 86 | padding-right: 10px; 87 | min-width:20px; 88 | } 89 | 90 | table.coverage td span.cline-any { 91 | display: inline-block; 92 | padding: 0 5px; 93 | width: 100%; 94 | } 95 | .missing-if-branch { 96 | display: inline-block; 97 | margin-right: 5px; 98 | border-radius: 3px; 99 | position: relative; 100 | padding: 0 4px; 101 | background: #333; 102 | color: yellow; 103 | } 104 | 105 | .skip-if-branch { 106 | display: none; 107 | margin-right: 10px; 108 | position: relative; 109 | padding: 0 4px; 110 | background: #ccc; 111 | color: white; 112 | } 113 | .missing-if-branch .typ, .skip-if-branch .typ { 114 | color: inherit !important; 115 | } 116 | .coverage-summary { 117 | border-collapse: collapse; 118 | width: 100%; 119 | } 120 | .coverage-summary tr { border-bottom: 1px solid #bbb; } 121 | .keyline-all { border: 1px solid #ddd; } 122 | .coverage-summary td, .coverage-summary th { padding: 10px; } 123 | .coverage-summary tbody { border: 1px solid #bbb; } 124 | .coverage-summary td { border-right: 1px solid #bbb; } 125 | .coverage-summary td:last-child { border-right: none; } 126 | .coverage-summary th { 127 | text-align: left; 128 | font-weight: normal; 129 | white-space: nowrap; 130 | } 131 | .coverage-summary th.file { border-right: none !important; } 132 | .coverage-summary th.pct { } 133 | .coverage-summary th.pic, 134 | .coverage-summary th.abs, 135 | .coverage-summary td.pct, 136 | .coverage-summary td.abs { text-align: right; } 137 | .coverage-summary td.file { white-space: nowrap; } 138 | .coverage-summary td.pic { min-width: 120px !important; } 139 | .coverage-summary tfoot td { } 140 | 141 | .coverage-summary .sorter { 142 | height: 10px; 143 | width: 7px; 144 | display: inline-block; 145 | margin-left: 0.5em; 146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; 147 | } 148 | .coverage-summary .sorted .sorter { 149 | background-position: 0 -20px; 150 | } 151 | .coverage-summary .sorted-desc .sorter { 152 | background-position: 0 -10px; 153 | } 154 | .status-line { height: 10px; } 155 | /* yellow */ 156 | .cbranch-no { background: yellow !important; color: #111; } 157 | /* dark red */ 158 | .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } 159 | .low .chart { border:1px solid #C21F39 } 160 | .highlighted, 161 | .highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ 162 | background: #C21F39 !important; 163 | } 164 | /* medium red */ 165 | .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } 166 | /* light red */ 167 | .low, .cline-no { background:#FCE1E5 } 168 | /* light green */ 169 | .high, .cline-yes { background:rgb(230,245,208) } 170 | /* medium green */ 171 | .cstat-yes { background:rgb(161,215,106) } 172 | /* dark green */ 173 | .status-line.high, .high .cover-fill { background:rgb(77,146,33) } 174 | .high .chart { border:1px solid rgb(77,146,33) } 175 | /* dark yellow (gold) */ 176 | .status-line.medium, .medium .cover-fill { background: #f9cd0b; } 177 | .medium .chart { border:1px solid #f9cd0b; } 178 | /* light yellow */ 179 | .medium { background: #fff4c2; } 180 | 181 | .cstat-skip { background: #ddd; color: #111; } 182 | .fstat-skip { background: #ddd; color: #111 !important; } 183 | .cbranch-skip { background: #ddd !important; color: #111; } 184 | 185 | span.cline-neutral { background: #eaeaea; } 186 | 187 | .coverage-summary td.empty { 188 | opacity: .5; 189 | padding-top: 4px; 190 | padding-bottom: 4px; 191 | line-height: 1; 192 | color: #888; 193 | } 194 | 195 | .cover-fill, .cover-empty { 196 | display:inline-block; 197 | height: 12px; 198 | } 199 | .chart { 200 | line-height: 0; 201 | } 202 | .cover-empty { 203 | background: white; 204 | } 205 | .cover-full { 206 | border-right: none !important; 207 | } 208 | pre.prettyprint { 209 | border: none !important; 210 | padding: 0 !important; 211 | margin: 0 !important; 212 | } 213 | .com { color: #999 !important; } 214 | .ignore-none { color: #999; font-weight: normal; } 215 | 216 | .wrapper { 217 | min-height: 100%; 218 | height: auto !important; 219 | height: 100%; 220 | margin: 0 auto -48px; 221 | } 222 | .footer, .push { 223 | height: 48px; 224 | } 225 | -------------------------------------------------------------------------------- /coverage/lcov-report/index.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for index.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files index.ts

23 |
24 | 25 |
26 | 100% 27 | Statements 28 | 25/25 29 |
30 | 31 | 32 |
33 | 100% 34 | Branches 35 | 0/0 36 |
37 | 38 | 39 |
40 | 50% 41 | Functions 42 | 2/4 43 |
44 | 45 | 46 |
47 | 100% 48 | Lines 49 | 25/25 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 17 77 | 18 78 | 19 79 | 20 80 | 21 81 | 22 82 | 23 83 | 24 84 | 25 85 | 26 86 | 27 87 | 28 88 | 295x 89 | 5x 90 | 5x 91 | 5x 92 | 5x 93 | 5x 94 | 5x 95 | 5x 96 | 5x 97 | 5x 98 | 5x 99 |   100 |   101 | 5x 102 | 5x 103 | 5x 104 | 5x 105 | 5x 106 | 5x 107 | 5x 108 | 5x 109 | 5x 110 | 5x 111 | 7x 112 | 5x 113 | 7x 114 | 5x 115 |   116 |  
import set from './set';
117 | import sadd from './sadd';
118 | import smembers from './smembers';
119 | import rm from './rm';
120 | import get from './get';
121 | import getAll from './getAll';
122 | import flush from './flush';
123 | import keys from './keys';
124 | import sismember from './sismember';
125 | import srem from './srem';
126 | import { getPrefix, hasPrefix, setPrefix, getPrefixedKey } from './prefix';
127 |  
128 | export {
129 |   set,
130 |   sadd,
131 |   smembers,
132 |   rm,
133 |   get,
134 |   getAll,
135 |   flush,
136 |   keys,
137 |   sismember,
138 |   srem,
139 |   getPrefixedKey,
140 |   getPrefix,
141 |   setPrefix,
142 |   hasPrefix,
143 | };
144 |  
145 | 146 |
147 |
148 | 153 | 154 | 155 | 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /coverage/lcov-report/get.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for get.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files get.ts

23 |
24 | 25 |
26 | 92.86% 27 | Statements 28 | 13/14 29 |
30 | 31 | 32 |
33 | 80% 34 | Branches 35 | 8/10 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 1/1 43 |
44 | 45 | 46 |
47 | 92.86% 48 | Lines 49 | 13/14 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 17 77 | 18 78 | 19 79 | 20 80 | 21 81 | 22 82 | 23 83 | 24 84 | 25 85 | 26 86 | 27 87 | 28 88 | 29 89 | 305x 90 |   91 | 5x 92 |   93 |   94 |   95 |   96 | 39x 97 |   98 |   99 | 39x 100 | 39x 101 | 39x 102 | 37x 103 |   104 |   105 | 5x 106 | 5x 107 |   108 |   109 |   110 |   111 |   112 | 39x 113 | 3x 114 | 36x 115 | 36x 116 |   117 |   118 |  
import { getPrefixedKey } from './prefix';
119 |  
120 | export default function get(
121 |   key: string,
122 |   missing?: any,
123 |   options?: Options
124 | ): any {
125 |   const queryKey = getPrefixedKey(key, options);
126 |   let value;
127 |  
128 |   const localValue = localStorage.getItem(queryKey);
129 |   try {
130 |     if (localValue !== null) {
131 |       value = JSON.parse(localValue);
132 |     }
133 |   } catch (e) {
134 |     Eif (localStorage[queryKey]) {
135 |       value = { data: localStorage.getItem(queryKey) };
136 |     } else {
137 |       value = null;
138 |     }
139 |   }
140 |  
141 |   if (!value) {
142 |     return missing;
143 |   } else Eif (typeof value === 'object' && typeof value.data !== 'undefined') {
144 |     return value.data;
145 |   }
146 | }
147 |  
148 | 149 |
150 |
151 | 156 | 157 | 158 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /coverage/lcov-report/sadd.ts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for sadd.ts 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files sadd.ts

23 |
24 | 25 |
26 | 80% 27 | Statements 28 | 12/15 29 |
30 | 31 | 32 |
33 | 50% 34 | Branches 35 | 2/4 36 |
37 | 38 | 39 |
40 | 100% 41 | Functions 42 | 1/1 43 |
44 | 45 | 46 |
47 | 80% 48 | Lines 49 | 12/15 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |

 60 | 
1 61 | 2 62 | 3 63 | 4 64 | 5 65 | 6 66 | 7 67 | 8 68 | 9 69 | 10 70 | 11 71 | 12 72 | 13 73 | 14 74 | 15 75 | 16 76 | 17 77 | 18 78 | 19 79 | 20 80 | 21 81 | 22 82 | 23 83 | 24 84 | 25 85 | 26 86 | 27 87 | 28 88 | 29 89 | 30 90 | 31 91 | 32 92 | 33 93 | 34 94 | 356x 95 | 6x 96 |   97 | 6x 98 |   99 |   100 |   101 |   102 | 43x 103 |   104 |   105 | 43x 106 |   107 | 43x 108 | 11x 109 |   110 |   111 | 32x 112 | 32x 113 | 32x 114 | 32x 115 |   116 |   117 |   118 |   119 |   120 |   121 |   122 |   123 |   124 |   125 |   126 | 32x 127 |   128 |  
import smembers from './smembers';
129 | import { getPrefixedKey } from './prefix';
130 |  
131 | export default function sadd(
132 |   key: string,
133 |   value: any,
134 |   options?: Options
135 | ): boolean {
136 |   const queryKey = getPrefixedKey(key, options);
137 |   let json;
138 |  
139 |   var values = smembers(key);
140 |  
141 |   if (values.indexOf(value) > -1) {
142 |     return false;
143 |   }
144 |  
145 |   try {
146 |     values.push(value);
147 |     json = JSON.stringify({ data: values });
148 |     localStorage.setItem(queryKey, json);
149 |   } catch (e) {
150 |     console.log(e);
151 |     if (console)
152 |       console.warn(
153 |         "Lockr didn't successfully add the " +
154 |           value +
155 |           ' to ' +
156 |           key +
157 |           ' set, because the localStorage is full.'
158 |       );
159 |   }
160 |   return true;
161 | }
162 |  
163 | 164 |
165 |
166 | 171 | 172 | 173 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /coverage/clover.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /coverage/lcov-report/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Code coverage report for All files 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 |
22 |

All files

23 |
24 | 25 |
26 | 93.94% 27 | Statements 28 | 124/132 29 |
30 | 31 | 32 |
33 | 77.5% 34 | Branches 35 | 31/40 36 |
37 | 38 | 39 |
40 | 90.91% 41 | Functions 42 | 20/22 43 |
44 | 45 | 46 |
47 | 93.94% 48 | Lines 49 | 124/132 50 |
51 | 52 | 53 |
54 |

55 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 56 |

57 |
58 |
59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 |
FileStatementsBranchesFunctionsLines
flush.ts 78 |
79 |
100%7/7100%2/2100%2/2100%7/7
get.ts 93 |
94 |
92.86%13/1480%8/10100%1/192.86%13/14
getAll.ts 108 |
109 |
100%12/12100%2/2100%3/3100%12/12
global.d.ts 123 |
124 |
0%0/00%0/00%0/00%0/0
index.ts 138 |
139 |
100%25/25100%0/050%2/4100%25/25
keys.ts 153 |
154 |
100%11/11100%4/4100%2/2100%11/11
prefix.ts 168 |
169 |
100%13/13100%6/6100%4/4100%13/13
rm.ts 183 |
184 |
100%4/4100%0/0100%1/1100%4/4
sadd.ts 198 |
199 |
80%12/1550%2/4100%1/180%12/15
set.ts 213 |
214 |
71.43%5/70%0/2100%1/171.43%5/7
sismember.ts 228 |
229 |
100%3/3100%0/0100%1/1100%3/3
smembers.ts 243 |
244 |
100%8/8100%6/6100%1/1100%8/8
srem.ts 258 |
259 |
84.62%11/1325%1/4100%1/184.62%11/13
272 |
273 |
274 |
275 | 280 | 281 | 282 | 287 | 288 | 289 | 290 | 291 | -------------------------------------------------------------------------------- /coverage/lcov-report/prettify.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /coverage/coverage-final.json: -------------------------------------------------------------------------------- 1 | {"/Users/dimitristsironis/Code/lockr/src/flush.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/flush.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":53}},"2":{"start":{"line":5,"column":2},"end":{"line":11,"column":null}},"3":{"start":{"line":6,"column":4},"end":{"line":8,"column":7}},"4":{"start":{"line":7,"column":6},"end":{"line":7,"column":51}},"5":{"start":{"line":10,"column":4},"end":{"line":10,"column":25}},"6":{"start":{"line":4,"column":0},"end":{"line":4,"column":24}}},"fnMap":{"0":{"name":"flush","decl":{"start":{"line":4,"column":24},"end":{"line":4,"column":29}},"loc":{"start":{"line":4,"column":29},"end":{"line":12,"column":1}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":6,"column":19},"end":{"line":6,"column":22}},"loc":{"start":{"line":6,"column":22},"end":{"line":8,"column":5}}}},"branchMap":{"0":{"loc":{"start":{"line":5,"column":2},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":5,"column":2},"end":{"line":11,"column":null}},{"start":{"line":5,"column":2},"end":{"line":11,"column":null}}]}},"s":{"0":5,"1":5,"2":15,"3":3,"4":11,"5":12,"6":5},"f":{"0":15,"1":11},"b":{"0":[3,12]}} 2 | ,"/Users/dimitristsironis/Code/lockr/src/get.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/get.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},"1":{"start":{"line":8,"column":19},"end":{"line":8,"column":47}},"2":{"start":{"line":11,"column":21},"end":{"line":11,"column":51}},"3":{"start":{"line":12,"column":2},"end":{"line":22,"column":null}},"4":{"start":{"line":13,"column":4},"end":{"line":15,"column":null}},"5":{"start":{"line":14,"column":6},"end":{"line":14,"column":37}},"6":{"start":{"line":17,"column":4},"end":{"line":21,"column":null}},"7":{"start":{"line":18,"column":6},"end":{"line":18,"column":55}},"8":{"start":{"line":20,"column":6},"end":{"line":20,"column":19}},"9":{"start":{"line":24,"column":2},"end":{"line":28,"column":null}},"10":{"start":{"line":25,"column":4},"end":{"line":25,"column":19}},"11":{"start":{"line":26,"column":9},"end":{"line":28,"column":null}},"12":{"start":{"line":27,"column":4},"end":{"line":27,"column":22}},"13":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}},"fnMap":{"0":{"name":"get","decl":{"start":{"line":3,"column":24},"end":{"line":3,"column":27}},"loc":{"start":{"line":6,"column":19},"end":{"line":29,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":13,"column":4},"end":{"line":15,"column":null}},"type":"if","locations":[{"start":{"line":13,"column":4},"end":{"line":15,"column":null}},{"start":{"line":13,"column":4},"end":{"line":15,"column":null}}]},"1":{"loc":{"start":{"line":17,"column":4},"end":{"line":21,"column":null}},"type":"if","locations":[{"start":{"line":17,"column":4},"end":{"line":21,"column":null}},{"start":{"line":17,"column":4},"end":{"line":21,"column":null}}]},"2":{"loc":{"start":{"line":24,"column":2},"end":{"line":28,"column":null}},"type":"if","locations":[{"start":{"line":24,"column":2},"end":{"line":28,"column":null}},{"start":{"line":24,"column":2},"end":{"line":28,"column":null}}]},"3":{"loc":{"start":{"line":26,"column":9},"end":{"line":28,"column":null}},"type":"if","locations":[{"start":{"line":26,"column":9},"end":{"line":28,"column":null}},{"start":{"line":26,"column":9},"end":{"line":28,"column":null}}]},"4":{"loc":{"start":{"line":26,"column":13},"end":{"line":26,"column":38}},"type":"binary-expr","locations":[{"start":{"line":26,"column":13},"end":{"line":26,"column":38}},{"start":{"line":26,"column":42},"end":{"line":26,"column":75}}]}},"s":{"0":5,"1":39,"2":39,"3":39,"4":39,"5":37,"6":5,"7":5,"8":0,"9":39,"10":3,"11":36,"12":36,"13":5},"f":{"0":39},"b":{"0":[37,2],"1":[5,0],"2":[3,36],"3":[36,0],"4":[36,36]}} 3 | ,"/Users/dimitristsironis/Code/lockr/src/getAll.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/getAll.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":44}},"2":{"start":{"line":5,"column":15},"end":{"line":5,"column":24}},"3":{"start":{"line":7,"column":2},"end":{"line":14,"column":null}},"4":{"start":{"line":8,"column":4},"end":{"line":13,"column":11}},"5":{"start":{"line":9,"column":29},"end":{"line":9,"column":31}},"6":{"start":{"line":10,"column":6},"end":{"line":10,"column":30}},"7":{"start":{"line":11,"column":6},"end":{"line":11,"column":26}},"8":{"start":{"line":12,"column":6},"end":{"line":12,"column":19}},"9":{"start":{"line":16,"column":2},"end":{"line":18,"column":5}},"10":{"start":{"line":17,"column":4},"end":{"line":17,"column":20}},"11":{"start":{"line":4,"column":0},"end":{"line":4,"column":24}}},"fnMap":{"0":{"name":"getAll","decl":{"start":{"line":4,"column":24},"end":{"line":4,"column":30}},"loc":{"start":{"line":4,"column":52},"end":{"line":19,"column":1}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":23},"end":{"line":8,"column":32}},"loc":{"start":{"line":8,"column":42},"end":{"line":13,"column":5}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":16,"column":18},"end":{"line":16,"column":27}},"loc":{"start":{"line":16,"column":30},"end":{"line":18,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":2},"end":{"line":14,"column":null}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":14,"column":null}},{"start":{"line":7,"column":2},"end":{"line":14,"column":null}}]}},"s":{"0":5,"1":5,"2":10,"3":10,"4":1,"5":6,"6":6,"7":6,"8":6,"9":9,"10":25,"11":5},"f":{"0":10,"1":6,"2":25},"b":{"0":[1,9]}} 4 | ,"/Users/dimitristsironis/Code/lockr/src/global.d.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/global.d.ts","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"inputSourceMap":null} 5 | ,"/Users/dimitristsironis/Code/lockr/src/index.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/index.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}},"1":{"start":{"line":14,"column":2},"end":{"line":1,"column":24}},"2":{"start":{"line":2,"column":0},"end":{"line":2,"column":7}},"3":{"start":{"line":15,"column":2},"end":{"line":2,"column":26}},"4":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}},"5":{"start":{"line":16,"column":2},"end":{"line":3,"column":34}},"6":{"start":{"line":4,"column":0},"end":{"line":4,"column":7}},"7":{"start":{"line":17,"column":2},"end":{"line":4,"column":22}},"8":{"start":{"line":5,"column":0},"end":{"line":5,"column":7}},"9":{"start":{"line":18,"column":2},"end":{"line":5,"column":24}},"10":{"start":{"line":6,"column":0},"end":{"line":6,"column":7}},"11":{"start":{"line":19,"column":2},"end":{"line":6,"column":30}},"12":{"start":{"line":7,"column":0},"end":{"line":7,"column":7}},"13":{"start":{"line":20,"column":2},"end":{"line":7,"column":28}},"14":{"start":{"line":8,"column":0},"end":{"line":8,"column":7}},"15":{"start":{"line":21,"column":2},"end":{"line":8,"column":26}},"16":{"start":{"line":9,"column":0},"end":{"line":9,"column":7}},"17":{"start":{"line":22,"column":2},"end":{"line":9,"column":36}},"18":{"start":{"line":10,"column":0},"end":{"line":10,"column":7}},"19":{"start":{"line":23,"column":2},"end":{"line":10,"column":26}},"20":{"start":{"line":11,"column":0},"end":{"line":11,"column":9}},"21":{"start":{"line":25,"column":2},"end":{"line":11,"column":20}},"22":{"start":{"line":27,"column":2},"end":{"line":11,"column":31}},"23":{"start":{"line":26,"column":2},"end":{"line":11,"column":42}},"24":{"start":{"line":24,"column":2},"end":{"line":11,"column":75}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":25,"column":2},"end":{"line":25,"column":11}},"loc":{"start":{"line":25,"column":2},"end":{"line":11,"column":20}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":27,"column":2},"end":{"line":27,"column":11}},"loc":{"start":{"line":27,"column":2},"end":{"line":11,"column":31}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":26,"column":2},"end":{"line":26,"column":11}},"loc":{"start":{"line":26,"column":2},"end":{"line":11,"column":42}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":24,"column":2},"end":{"line":24,"column":16}},"loc":{"start":{"line":24,"column":2},"end":{"line":11,"column":75}}}},"branchMap":{},"s":{"0":5,"1":5,"2":5,"3":5,"4":5,"5":5,"6":5,"7":5,"8":5,"9":5,"10":5,"11":5,"12":5,"13":5,"14":5,"15":5,"16":5,"17":5,"18":5,"19":5,"20":5,"21":5,"22":5,"23":7,"24":7},"f":{"0":0,"1":0,"2":2,"3":2},"b":{}} 6 | ,"/Users/dimitristsironis/Code/lockr/src/keys.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/keys.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}},"1":{"start":{"line":3,"column":17},"end":{"line":3,"column":28}},"2":{"start":{"line":4,"column":27},"end":{"line":4,"column":29}},"3":{"start":{"line":5,"column":18},"end":{"line":5,"column":43}},"4":{"start":{"line":7,"column":2},"end":{"line":9,"column":null}},"5":{"start":{"line":8,"column":4},"end":{"line":8,"column":19}},"6":{"start":{"line":11,"column":2},"end":{"line":15,"column":5}},"7":{"start":{"line":12,"column":4},"end":{"line":14,"column":null}},"8":{"start":{"line":13,"column":6},"end":{"line":13,"column":41}},"9":{"start":{"line":17,"column":2},"end":{"line":17,"column":14}},"10":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}},"fnMap":{"0":{"name":"keys","decl":{"start":{"line":2,"column":24},"end":{"line":2,"column":28}},"loc":{"start":{"line":2,"column":28},"end":{"line":18,"column":1}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":11,"column":18},"end":{"line":11,"column":27}},"loc":{"start":{"line":11,"column":30},"end":{"line":15,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":2},"end":{"line":9,"column":null}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":9,"column":null}},{"start":{"line":7,"column":2},"end":{"line":9,"column":null}}]},"1":{"loc":{"start":{"line":12,"column":4},"end":{"line":14,"column":null}},"type":"if","locations":[{"start":{"line":12,"column":4},"end":{"line":14,"column":null}},{"start":{"line":12,"column":4},"end":{"line":14,"column":null}}]}},"s":{"0":5,"1":15,"2":15,"3":15,"4":15,"5":7,"6":8,"7":35,"8":25,"9":8,"10":5},"f":{"0":15,"1":35},"b":{"0":[7,8],"1":[25,10]}} 7 | ,"/Users/dimitristsironis/Code/lockr/src/prefix.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/prefix.ts","statementMap":{"0":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}},"1":{"start":{"line":3,"column":2},"end":{"line":3,"column":18}},"2":{"start":{"line":4,"column":2},"end":{"line":4,"column":16}},"3":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}},"4":{"start":{"line":7,"column":2},"end":{"line":11,"column":null}},"5":{"start":{"line":8,"column":4},"end":{"line":8,"column":15}},"6":{"start":{"line":10,"column":4},"end":{"line":10,"column":29}},"7":{"start":{"line":6,"column":0},"end":{"line":6,"column":16}},"8":{"start":{"line":15,"column":2},"end":{"line":15,"column":27}},"9":{"start":{"line":14,"column":0},"end":{"line":14,"column":16}},"10":{"start":{"line":19,"column":2},"end":{"line":19,"column":16}},"11":{"start":{"line":18,"column":0},"end":{"line":18,"column":16}},"12":{"start":{"line":22,"column":0},"end":{"line":22,"column":25}}},"fnMap":{"0":{"name":"setPrefix","decl":{"start":{"line":2,"column":16},"end":{"line":2,"column":25}},"loc":{"start":{"line":2,"column":40},"end":{"line":5,"column":1}}},"1":{"name":"getPrefixedKey","decl":{"start":{"line":6,"column":16},"end":{"line":6,"column":30}},"loc":{"start":{"line":6,"column":61},"end":{"line":12,"column":1}}},"2":{"name":"hasPrefix","decl":{"start":{"line":14,"column":16},"end":{"line":14,"column":25}},"loc":{"start":{"line":14,"column":25},"end":{"line":16,"column":1}}},"3":{"name":"getPrefix","decl":{"start":{"line":18,"column":16},"end":{"line":18,"column":25}},"loc":{"start":{"line":18,"column":25},"end":{"line":20,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":2},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":11,"column":null}},{"start":{"line":7,"column":2},"end":{"line":11,"column":null}}]},"1":{"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":15}},"type":"cond-expr","locations":[{"start":{"line":7,"column":13},"end":{"line":7,"column":15}},{"start":{"line":7,"column":6},"end":{"line":7,"column":23}}]},"2":{"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":15}},"type":"binary-expr","locations":[{"start":{"line":7,"column":6},"end":{"line":7,"column":15}},{"start":{"line":7,"column":6},"end":{"line":7,"column":15}}]}},"s":{"0":6,"1":2,"2":2,"3":6,"4":205,"5":1,"6":204,"7":6,"8":30,"9":6,"10":15,"11":6,"12":6},"f":{"0":2,"1":205,"2":30,"3":15},"b":{"0":[1,204],"1":[203,2],"2":[205,205]}} 8 | ,"/Users/dimitristsironis/Code/lockr/src/rm.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/rm.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},"1":{"start":{"line":4,"column":19},"end":{"line":4,"column":47}},"2":{"start":{"line":6,"column":2},"end":{"line":6,"column":43}},"3":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}},"fnMap":{"0":{"name":"rm","decl":{"start":{"line":3,"column":24},"end":{"line":3,"column":26}},"loc":{"start":{"line":3,"column":57},"end":{"line":7,"column":1}}}},"branchMap":{},"s":{"0":5,"1":1,"2":1,"3":5},"f":{"0":1},"b":{}} 9 | ,"/Users/dimitristsironis/Code/lockr/src/sadd.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/sadd.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":42}},"2":{"start":{"line":9,"column":19},"end":{"line":9,"column":47}},"3":{"start":{"line":12,"column":15},"end":{"line":12,"column":28}},"4":{"start":{"line":14,"column":2},"end":{"line":16,"column":null}},"5":{"start":{"line":15,"column":4},"end":{"line":15,"column":17}},"6":{"start":{"line":18,"column":2},"end":{"line":32,"column":null}},"7":{"start":{"line":19,"column":4},"end":{"line":19,"column":23}},"8":{"start":{"line":20,"column":4},"end":{"line":20,"column":44}},"9":{"start":{"line":21,"column":4},"end":{"line":21,"column":41}},"10":{"start":{"line":23,"column":4},"end":{"line":23,"column":19}},"11":{"start":{"line":24,"column":4},"end":{"line":31,"column":8}},"12":{"start":{"line":25,"column":6},"end":{"line":31,"column":8}},"13":{"start":{"line":33,"column":2},"end":{"line":33,"column":14}},"14":{"start":{"line":4,"column":0},"end":{"line":4,"column":24}}},"fnMap":{"0":{"name":"sadd","decl":{"start":{"line":4,"column":24},"end":{"line":4,"column":28}},"loc":{"start":{"line":7,"column":19},"end":{"line":34,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":14,"column":2},"end":{"line":16,"column":null}},"type":"if","locations":[{"start":{"line":14,"column":2},"end":{"line":16,"column":null}},{"start":{"line":14,"column":2},"end":{"line":16,"column":null}}]},"1":{"loc":{"start":{"line":24,"column":4},"end":{"line":31,"column":8}},"type":"if","locations":[{"start":{"line":24,"column":4},"end":{"line":31,"column":8}},{"start":{"line":24,"column":4},"end":{"line":31,"column":8}}]}},"s":{"0":6,"1":6,"2":43,"3":43,"4":43,"5":11,"6":32,"7":32,"8":32,"9":32,"10":0,"11":0,"12":0,"13":32,"14":6},"f":{"0":43},"b":{"0":[11,32],"1":[0,0]}} 10 | ,"/Users/dimitristsironis/Code/lockr/src/set.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/set.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},"1":{"start":{"line":5,"column":18},"end":{"line":5,"column":46}},"2":{"start":{"line":7,"column":2},"end":{"line":15,"column":null}},"3":{"start":{"line":8,"column":4},"end":{"line":8,"column":69}},"4":{"start":{"line":10,"column":4},"end":{"line":14,"column":null}},"5":{"start":{"line":11,"column":6},"end":{"line":13,"column":8}},"6":{"start":{"line":4,"column":0},"end":{"line":4,"column":24}}},"fnMap":{"0":{"name":"set","decl":{"start":{"line":4,"column":24},"end":{"line":4,"column":27}},"loc":{"start":{"line":4,"column":70},"end":{"line":16,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":4},"end":{"line":14,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":4},"end":{"line":14,"column":null}},{"start":{"line":10,"column":4},"end":{"line":14,"column":null}}]}},"s":{"0":5,"1":59,"2":59,"3":59,"4":0,"5":0,"6":5},"f":{"0":59},"b":{"0":[0,0]}} 11 | ,"/Users/dimitristsironis/Code/lockr/src/sismember.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/sismember.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},"1":{"start":{"line":4,"column":2},"end":{"line":4,"column":43}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}},"fnMap":{"0":{"name":"sismember","decl":{"start":{"line":3,"column":24},"end":{"line":3,"column":33}},"loc":{"start":{"line":3,"column":57},"end":{"line":5,"column":1}}}},"branchMap":{},"s":{"0":6,"1":3,"2":6},"f":{"0":3},"b":{}} 12 | ,"/Users/dimitristsironis/Code/lockr/src/smembers.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/smembers.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},"1":{"start":{"line":3,"column":19},"end":{"line":3,"column":47}},"2":{"start":{"line":6,"column":21},"end":{"line":6,"column":51}},"3":{"start":{"line":7,"column":2},"end":{"line":11,"column":null}},"4":{"start":{"line":8,"column":4},"end":{"line":8,"column":35}},"5":{"start":{"line":10,"column":4},"end":{"line":10,"column":17}},"6":{"start":{"line":13,"column":2},"end":{"line":13,"column":47}},"7":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}}},"fnMap":{"0":{"name":"smembers","decl":{"start":{"line":2,"column":24},"end":{"line":2,"column":32}},"loc":{"start":{"line":2,"column":63},"end":{"line":14,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":2},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":11,"column":null}},{"start":{"line":7,"column":2},"end":{"line":11,"column":null}}]},"1":{"loc":{"start":{"line":13,"column":31},"end":{"line":13,"column":41}},"type":"cond-expr","locations":[{"start":{"line":13,"column":31},"end":{"line":13,"column":41}},{"start":{"line":13,"column":44},"end":{"line":13,"column":46}}]},"2":{"loc":{"start":{"line":13,"column":9},"end":{"line":13,"column":14}},"type":"binary-expr","locations":[{"start":{"line":13,"column":9},"end":{"line":13,"column":14}},{"start":{"line":13,"column":18},"end":{"line":13,"column":28}}]}},"s":{"0":6,"1":49,"2":49,"3":49,"4":33,"5":16,"6":49,"7":6},"f":{"0":49},"b":{"0":[33,16],"1":[33,16],"2":[49,33]}} 13 | ,"/Users/dimitristsironis/Code/lockr/src/srem.ts": {"path":"/Users/dimitristsironis/Code/lockr/src/srem.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":34}},"2":{"start":{"line":5,"column":19},"end":{"line":5,"column":47}},"3":{"start":{"line":6,"column":17},"end":{"line":6,"column":37}},"4":{"start":{"line":7,"column":16},"end":{"line":7,"column":37}},"5":{"start":{"line":9,"column":2},"end":{"line":11,"column":null}},"6":{"start":{"line":10,"column":4},"end":{"line":10,"column":28}},"7":{"start":{"line":13,"column":15},"end":{"line":13,"column":47}},"8":{"start":{"line":15,"column":2},"end":{"line":22,"column":null}},"9":{"start":{"line":16,"column":4},"end":{"line":16,"column":41}},"10":{"start":{"line":18,"column":4},"end":{"line":21,"column":8}},"11":{"start":{"line":19,"column":6},"end":{"line":21,"column":8}},"12":{"start":{"line":4,"column":0},"end":{"line":4,"column":24}}},"fnMap":{"0":{"name":"srem","decl":{"start":{"line":4,"column":24},"end":{"line":4,"column":28}},"loc":{"start":{"line":4,"column":71},"end":{"line":23,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":9,"column":2},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":9,"column":2},"end":{"line":11,"column":null}},{"start":{"line":9,"column":2},"end":{"line":11,"column":null}}]},"1":{"loc":{"start":{"line":18,"column":4},"end":{"line":21,"column":8}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":21,"column":8}},{"start":{"line":18,"column":4},"end":{"line":21,"column":8}}]}},"s":{"0":6,"1":6,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":0,"11":0,"12":6},"f":{"0":1},"b":{"0":[1,0],"1":[0,0]}} 14 | } 15 | --------------------------------------------------------------------------------