@washingtonpost/front-end-utils
Advanced tools
Comparing version 0.5.0-experimental-erika.6 to 0.5.0
@@ -1,2 +0,2 @@ | ||
var m=Object.defineProperty,x=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var g=(t,e,n)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))j.call(e,n)&&g(t,n,e[n]);if(l)for(var n of l(e))b.call(e,n)&&g(t,n,e[n]);return t},f=(t,e)=>x(t,y(e));var w=t=>t.replace(/[,.]/g,"").replace(/&/g,"and").replace(/\s/g,"-").toLowerCase();var $=(t="",e={})=>{let n=t;return Object.entries(e).forEach(([o,c])=>{c&&(n+=` ${o}`)}),n.trim()};var F=async(t,e)=>{let o=await(await fetch(t,f(p({},e),{headers:f(p({},e.headers),{Accept:"application/json","Content-Type":"application/json"})}))).json();if(!o.ok)throw o.json||o;return o.json};var N=t=>{if(typeof window>"u")return;let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null},v=(t,e,n=!1)=>{document.cookie=`${t}=${e};`+(n&&`domain=.${window.origin.split(".").slice(-2).join(".")}; path=/;`)};var E=t=>{let e=[],n=t;t.includes("?")&&(n=t.slice(1)),n.split("&").forEach(s=>{let[r=!1,h=!1]=s.split("=");e.push({name:r,val:h})});function c(s){try{return e.find(r=>r.name===s)}catch(r){console.error(r)}}function u(s){let r=c(s);return r?r.val:!1}function d(s){let r=c(s);return r?s===r.name:!1}return{get:u,has:d}};export{F as JSONFetch,$ as getClasses,N as getCookie,v as setCookie,w as slugify,E as urlSearchParams}; | ||
var g=t=>t.replace(/[,.]/g,"").replace(/&/g,"and").replace(/\s/g,"-").toLowerCase();var h=(t="",e={})=>{let n=t;return Object.entries(e).forEach(([o,c])=>{c&&(n+=` ${o}`)}),n.trim()};var u=t=>new Promise(e=>t.json().then(n=>e({status:t.status,ok:t.ok,json:n}))),x=async(t,e)=>{let n=await fetch(t,{...e,headers:{...e.headers,Accept:"application/json","Content-Type":"application/json"}}),o=await u(n);if(!o.ok)throw o.json||o;return o.json};var j=t=>{if(typeof window>"u")return;let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null},k=(t,e,n=!1)=>{document.cookie=`${t}=${e};`+(n&&`domain=.${window.origin.split(".").slice(-2).join(".")}; path=/;`)};var w=t=>{let e=[],n=t;t.includes("?")&&(n=t.slice(1)),n.split("&").forEach(r=>{let[s=!1,p=!1]=r.split("=");e.push({name:s,val:p})});function c(r){try{return e.find(s=>s.name===r)}catch(s){console.error(s)}}function f(r){let s=c(r);return s?s.val:!1}function l(r){let s=c(r);return s?r===s.name:!1}return{get:f,has:l}};export{x as JSONFetch,h as getClasses,j as getCookie,k as setCookie,g as slugify,w as urlSearchParams}; | ||
//# sourceMappingURL=index.js.map |
@@ -32,3 +32,3 @@ /** | ||
interface JSONFetchOptions { | ||
type JSONFetchOptions = { | ||
method?: string; | ||
@@ -38,4 +38,14 @@ headers?: { | ||
}; | ||
} | ||
declare const JSONFetch: (url: string, options: JSONFetchOptions) => Promise<() => any>; | ||
}; | ||
type JSONFetchResponse = { | ||
status: number; | ||
statusText: string; | ||
headers: { | ||
[key: string]: string; | ||
}; | ||
body: string; | ||
ok: boolean; | ||
json: () => any; | ||
}; | ||
declare const JSONFetch: (url: string, options: JSONFetchOptions) => Promise<JSONFetchResponse>; | ||
@@ -42,0 +52,0 @@ declare const getCookie: (name: string) => string | null | undefined; |
@@ -1,2 +0,2 @@ | ||
var c=Object.defineProperty,x=Object.defineProperties,y=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var g=(t,e,n)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))u.call(e,n)&&g(t,n,e[n]);if(l)for(var n of l(e))k.call(e,n)&&g(t,n,e[n]);return t},f=(t,e)=>x(t,j(e));var w=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},O=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!u.call(t,o)&&o!==n&&c(t,o,{get:()=>e[o],enumerable:!(s=y(e,o))||s.enumerable});return t};var $=t=>O(c({},"__esModule",{value:!0}),t);var E={};w(E,{JSONFetch:()=>J,getClasses:()=>F,getCookie:()=>N,setCookie:()=>v,slugify:()=>C,urlSearchParams:()=>S});module.exports=$(E);var C=t=>t.replace(/[,.]/g,"").replace(/&/g,"and").replace(/\s/g,"-").toLowerCase();var F=(t="",e={})=>{let n=t;return Object.entries(e).forEach(([s,o])=>{o&&(n+=` ${s}`)}),n.trim()};var J=async(t,e)=>{let s=await(await fetch(t,f(p({},e),{headers:f(p({},e.headers),{Accept:"application/json","Content-Type":"application/json"})}))).json();if(!s.ok)throw s.json||s;return s.json};var N=t=>{if(typeof window>"u")return;let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null},v=(t,e,n=!1)=>{document.cookie=`${t}=${e};`+(n&&`domain=.${window.origin.split(".").slice(-2).join(".")}; path=/;`)};var S=t=>{let e=[],n=t;t.includes("?")&&(n=t.slice(1)),n.split("&").forEach(i=>{let[r=!1,m=!1]=i.split("=");e.push({name:r,val:m})});function o(i){try{return e.find(r=>r.name===i)}catch(r){console.error(r)}}function d(i){let r=o(i);return r?r.val:!1}function h(i){let r=o(i);return r?i===r.name:!1}return{get:d,has:h}};0&&(module.exports={JSONFetch,getClasses,getCookie,setCookie,slugify,urlSearchParams}); | ||
"use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},m=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g(e))!d.call(t,o)&&o!==n&&c(t,o,{get:()=>e[o],enumerable:!(r=u(e,o))||r.enumerable});return t};var x=t=>m(c({},"__esModule",{value:!0}),t);var N={};h(N,{JSONFetch:()=>O,getClasses:()=>j,getCookie:()=>w,setCookie:()=>b,slugify:()=>y,urlSearchParams:()=>J});module.exports=x(N);var y=t=>t.replace(/[,.]/g,"").replace(/&/g,"and").replace(/\s/g,"-").toLowerCase();var j=(t="",e={})=>{let n=t;return Object.entries(e).forEach(([r,o])=>{o&&(n+=` ${r}`)}),n.trim()};var k=t=>new Promise(e=>t.json().then(n=>e({status:t.status,ok:t.ok,json:n}))),O=async(t,e)=>{let n=await fetch(t,{...e,headers:{...e.headers,Accept:"application/json","Content-Type":"application/json"}}),r=await k(n);if(!r.ok)throw r.json||r;return r.json};var w=t=>{if(typeof window>"u")return;let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null},b=(t,e,n=!1)=>{document.cookie=`${t}=${e};`+(n&&`domain=.${window.origin.split(".").slice(-2).join(".")}; path=/;`)};var J=t=>{let e=[],n=t;t.includes("?")&&(n=t.slice(1)),n.split("&").forEach(i=>{let[s=!1,p=!1]=i.split("=");e.push({name:s,val:p})});function o(i){try{return e.find(s=>s.name===i)}catch(s){console.error(s)}}function f(i){let s=o(i);return s?s.val:!1}function l(i){let s=o(i);return s?i===s.name:!1}return{get:f,has:l}};0&&(module.exports={JSONFetch,getClasses,getCookie,setCookie,slugify,urlSearchParams}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@washingtonpost/front-end-utils", | ||
"version": "0.5.0-experimental-erika.6", | ||
"version": "0.5.0", | ||
"description": "> TODO: description", | ||
"author": "artmsilva <artmsilva@gmail.com>", | ||
"homepage": "https://github.com/WPMedia/site-components#readme", | ||
"author": "WPDS Support <wpds@washpost.com>", | ||
"homepage": "https://github.com/WPMedia/wpds-site-furniture#readme", | ||
"license": "ISC", | ||
@@ -19,10 +19,11 @@ "source": "src/index.ts", | ||
"type": "git", | ||
"url": "git+https://github.com/WPMedia/site-components.git" | ||
"url": "git+https://github.com/WPMedia/wpds-site-furniture.get" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: run tests from root\" && exit 1", | ||
"build": "tsup src/index.ts --minify --format esm,cjs --dts --sourcemap --legacy-output" | ||
"build": "tsup src/index.ts --minify --format esm,cjs --dts --sourcemap --legacy-output", | ||
"dev": "tsup src/index.ts --watch --minify --format esm,cjs --dts --sourcemap --legacy-output" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WPMedia/site-components/issues" | ||
"url": "https://github.com/WPMedia/wpds-site-furniture/issues" | ||
}, | ||
@@ -34,3 +35,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "b4938ea75c83eba0e0d7ea039b2b2625e0cff53f" | ||
"gitHead": "92ce75ad79da1d25e2b6f999a7b1dcd3a23f91f1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
22604
77