UNPKG

bucklescript-tea

Version:
66 lines (51 loc) 1.3 kB
// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE 'use strict'; var Caml_option = require("bs-platform/lib/js/caml_option.js"); function length($$window) { var match = $$window.localStorage; if (match !== undefined) { return Caml_option.some(match.length); } } function clear($$window) { var match = $$window.localStorage; if (match !== undefined) { return Caml_option.some(match.clear()); } } function key($$window, idx) { var match = $$window.localStorage; if (match !== undefined) { return Caml_option.some(match.key(idx)); } } function getItem($$window, key) { var match = $$window.localStorage; if (match !== undefined) { try { return Caml_option.some(match.getItem(key)); } catch (exn){ return ; } } } function removeItem($$window, key) { var match = $$window.localStorage; if (match !== undefined) { return Caml_option.some(match.removeItem(key)); } } function setItem($$window, key, value) { var match = $$window.localStorage; if (match !== undefined) { return Caml_option.some(match.setItem(key, value)); } } exports.length = length; exports.clear = clear; exports.key = key; exports.getItem = getItem; exports.removeItem = removeItem; exports.setItem = setItem; /* No side effect */