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

gql

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gql - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

test/and.js

21

index.js

@@ -11,5 +11,5 @@ var roughMatch = require('./lib/genotypeMatch');

// higher-level, operates on nested conditions
all: function(conditions){
and: function(conditions){
if (!Array.isArray(conditions) || conditions.length === 0) {
throw new Error('all must receive an array with conditions');
throw new Error('and must receive an array with conditions');
}

@@ -32,2 +32,19 @@ return function(data){

},
only: function(k, v){
if (typeof v !== 'string') {
throw new Error('only can only check for strings');
}
if (v.length !== 1) {
throw new Error('only accepts only one allele')
}
return function(data){
var snp = data[k];
if (!(snp && snp.genotype)) {
return false;
}
return snp.genotype.split('').every(function(allele) {
return allele === v;
});
};
},
or: function(conditions){

@@ -34,0 +51,0 @@ if (!Array.isArray(conditions) || conditions.length === 0) {

2

package.json
{
"name": "gql",
"description": "Query language for interpreting genome SNPs",
"version": "1.0.0",
"version": "1.1.0",
"homepage": "http://github.com/genomejs/gql",

@@ -6,0 +6,0 @@ "repository": "git://github.com/genomejs/gql.git",

@@ -97,5 +97,5 @@ [![Build Status](https://travis-ci.org/genomejs/gql.png?branch=master)](https://travis-ci.org/genomejs/gql)

// evaluates to true if rs2032651 != AA
q.not(q.exact('rs2032651', 'AA'));
var query = q.not(q.exact('rs2032651', 'AA'));
q({
query({
rs2032651: {

@@ -106,3 +106,3 @@ genotype: 'TT'

q({
query({
rs2032651: {

@@ -114,2 +114,10 @@ genotype: 'AA'

#### only(id, allele)
Evaluates to true if only the allele was observed at the specified position.
```javascript
q.only('rs2032651', 'A'); // will match A, AA, AAA, etc.
```
### Aggregate Conditions

@@ -128,3 +136,3 @@

#### all(conditions...)
#### and(conditions...)

@@ -134,3 +142,3 @@ Evaluates to true if all of the given condition functions evaluate to true.

```javascript
q.all([
q.and([
q.exists('rs2032652'),

@@ -137,0 +145,0 @@ q.has('rs2032651', 'A')

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