Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

picosanity

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

picosanity - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

lib/browser.js

7

lib/client.js
'use strict';
var fetch = require('cross-fetch');
var enc = encodeURIComponent;

@@ -9,3 +7,3 @@ var apiHost = 'api.sanity.io';

function PicoSanity(config) {
function PicoSanity(config, fetcher) {
if (!(this instanceof PicoSanity)) {

@@ -16,2 +14,3 @@ return new PicoSanity(config);

this.cfg = config;
this.fetcher = fetcher;
}

@@ -27,3 +26,3 @@

var qs = getQs(query, params);
return fetch('https://' + cfg.projectId + '.' + host + '/v1/data/query/' + cfg.dataset + qs).then(function (res) {
return this.fetcher('https://' + cfg.projectId + '.' + host + '/v1/data/query/' + cfg.dataset + qs).then(function (res) {
return res.json();

@@ -30,0 +29,0 @@ }).then(function (res) {

{
"name": "picosanity",
"version": "1.0.1",
"version": "1.0.2",
"description": "Tiny Sanity client alternative should you only need to do queries",
"main": "lib/client.js",
"main": "lib/index.js",
"browser": "lib/browser.js",
"umd": "umd/client.js",

@@ -33,3 +34,3 @@ "scripts": {

"dependencies": {
"cross-fetch": "^2.2.1"
"node-fetch": "^2.1.2"
},

@@ -45,4 +46,5 @@ "devDependencies": {

"rimraf": "^2.6.2",
"webpack": "^4.12.0",
"webpack-command": "^0.2.1"
}
}

@@ -10,4 +10,4 @@ # picosanity

- Node.js >= 6
- Modern browsers (Edge, Chrome, Safari, Firefox etc)
- IE if Promise is polyfilled
- Modern browsers (Edge >= 14, Chrome, Safari, Firefox etc)
- IE if [Promise](https://github.com/taylorhakes/promise-polyfill) and [fetch](https://github.com/github/fetch) is polyfilled

@@ -14,0 +14,0 @@ ## Installation

@@ -1,3 +0,1 @@

const fetch = require('cross-fetch')
const enc = encodeURIComponent

@@ -7,3 +5,3 @@ const apiHost = 'api.sanity.io'

function PicoSanity(config) {
function PicoSanity(config, fetcher) {
if (!(this instanceof PicoSanity)) {

@@ -14,2 +12,3 @@ return new PicoSanity(config)

this.cfg = config
this.fetcher = fetcher
}

@@ -36,3 +35,3 @@

const qs = getQs(query, params)
return fetch(`https://${cfg.projectId}.${host}/v1/data/query/${cfg.dataset}${qs}`)
return this.fetcher(`https://${cfg.projectId}.${host}/v1/data/query/${cfg.dataset}${qs}`)
.then(res => res.json())

@@ -39,0 +38,0 @@ .then(res => res.result)

@@ -1,2 +0,2 @@

const Client = require('../src/client')
const Client = require('../src')

@@ -3,0 +3,0 @@ const expectedDoc = {

const path = require('path')
module.exports = {
entry: path.join(__dirname, 'lib', 'client.js'),
entry: path.join(__dirname, 'lib', 'browser.js'),
output: {

@@ -6,0 +6,0 @@ library: 'PicoSanity',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc