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

@getlang/lib

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getlang/lib - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

5

dist/slice.js

@@ -1,6 +0,7 @@

import { SliceError } from '@getlang/utils';
import { SliceError, NullSelection } from '@getlang/utils';
export const runSlice = async (slice, context = {}, raw = {}) => {
try {
const fn = new Function('$', '$$', slice);
return await fn(context, raw);
const value = await fn(context, raw);
return value === undefined ? new NullSelection('<slice>') : value;
}

@@ -7,0 +8,0 @@ catch (e) {

6

dist/values/headers.js

@@ -6,7 +6,7 @@ import { NullSelection } from '@getlang/utils';

}
const result = headers.get(selector);
const value = headers.get(selector);
if (expand) {
return result ? result.split(',').map(x => x.trimStart()) : [];
return value ? value.split(',').map(x => x.trimStart()) : [];
}
return result === null ? new NullSelection(selector) : result;
return value === null ? new NullSelection(selector) : value;
};

@@ -13,0 +13,0 @@ export const toValue = (headers) => {

@@ -28,7 +28,7 @@ /// <reference types="./html/types.d.ts" />

}
const result = xpath.select(selector, root);
const value = xpath.select(selector, root);
if (expand) {
return result;
return value;
}
return result.length ? result[0] : new NullSelection(selector);
return value.length ? value[0] : new NullSelection(selector);
};

@@ -42,7 +42,7 @@ const selectCss = (el, selector, expand) => {

}
const result = expand ? selectAll(selector, el) : selectOne(selector, el);
const value = expand ? selectAll(selector, el) : selectOne(selector, el);
if (expand) {
return result ?? [];
return value ?? [];
}
return result === null ? new NullSelection(selector) : result;
return value === null ? new NullSelection(selector) : value;
};

@@ -49,0 +49,0 @@ export const select = (el, selector, expand) => {

{
"name": "@getlang/lib",
"version": "0.0.16",
"version": "0.0.17",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "type": "module",

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

import { SliceError } from '@getlang/utils'
import { SliceError, NullSelection } from '@getlang/utils'

@@ -10,3 +10,4 @@ export const runSlice = async (

const fn = new Function('$', '$$', slice)
return await fn(context, raw)
const value = await fn(context, raw)
return value === undefined ? new NullSelection('<slice>') : value
} catch (e) {

@@ -13,0 +14,0 @@ throw new SliceError({ cause: e })

@@ -7,7 +7,7 @@ import { NullSelection } from '@getlang/utils'

}
const result = headers.get(selector)
const value = headers.get(selector)
if (expand) {
return result ? result.split(',').map(x => x.trimStart()) : []
return value ? value.split(',').map(x => x.trimStart()) : []
}
return result === null ? new NullSelection(selector) : result
return value === null ? new NullSelection(selector) : value
}

@@ -14,0 +14,0 @@

@@ -38,7 +38,7 @@ /// <reference types="./html/types.d.ts" />

const result = xpath.select(selector, root)
const value = xpath.select(selector, root)
if (expand) {
return result
return value
}
return result.length ? result[0] : new NullSelection(selector)
return value.length ? value[0] : new NullSelection(selector)
}

@@ -52,7 +52,7 @@

}
const result = expand ? selectAll(selector, el) : selectOne(selector, el)
const value = expand ? selectAll(selector, el) : selectOne(selector, el)
if (expand) {
return result ?? []
return value ?? []
}
return result === null ? new NullSelection(selector) : result
return value === null ? new NullSelection(selector) : value
}

@@ -59,0 +59,0 @@

Sorry, the diff of this file is not supported yet

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