wikidata-sdk
Advanced tools
Comparing version 0.1.0 to 0.1.1
// Generated by CoffeeScript 1.9.3 | ||
(function() { | ||
var buildUrl, wd_, | ||
var buildUrl, forceArray, ref, shortLang, wd_, | ||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -10,4 +10,6 @@ | ||
ref = require('../utils/misc'), forceArray = ref.forceArray, shortLang = ref.shortLang; | ||
module.exports = function(ids, languages, props, format) { | ||
var query, ref; | ||
var query; | ||
if (languages == null) { | ||
@@ -22,4 +24,5 @@ languages = ['en']; | ||
} | ||
ref = [ids, languages, props].map(wd_.toPropertiesArray), ids = ref[0], languages = ref[1], props = ref[2]; | ||
ids = wd_.normalizeIds(ids); | ||
ids = wd_.normalizeIds(forceArray(ids)); | ||
languages = forceArray(languages).map(shortLang); | ||
props = forceArray(props); | ||
if (indexOf.call(languages, 'en') < 0) { | ||
@@ -34,3 +37,3 @@ languages.push('en'); | ||
}; | ||
if ((props != null) && props.length > 0) { | ||
if ((props != null ? props.length : void 0) > 0) { | ||
query.props = props.join('|'); | ||
@@ -37,0 +40,0 @@ } |
@@ -27,2 +27,5 @@ // Generated by CoffeeScript 1.9.3 | ||
break; | ||
case 'monolingualtext': | ||
value = datavalue.value.text; | ||
break; | ||
case 'wikibase-item': | ||
@@ -29,0 +32,0 @@ value = 'Q' + datavalue.value['numeric-id']; |
@@ -75,12 +75,4 @@ // Generated by CoffeeScript 1.9.3 | ||
wd_.toPropertiesArray = function(obj) { | ||
if (typeof obj === 'string') { | ||
return obj = [obj]; | ||
} else { | ||
return obj || []; | ||
} | ||
}; | ||
module.exports = wd_; | ||
}).call(this); |
@@ -215,6 +215,6 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.wdk = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{"../utils/build_url":7,"../utils/utils":11}],5:[function(require,module,exports){ | ||
},{"../utils/build_url":7,"../utils/utils":12}],5:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
(function() { | ||
var buildUrl, wd_, | ||
var buildUrl, forceArray, ref, shortLang, wd_, | ||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -226,4 +226,6 @@ | ||
ref = require('../utils/misc'), forceArray = ref.forceArray, shortLang = ref.shortLang; | ||
module.exports = function(ids, languages, props, format) { | ||
var query, ref; | ||
var query; | ||
if (languages == null) { | ||
@@ -238,4 +240,5 @@ languages = ['en']; | ||
} | ||
ref = [ids, languages, props].map(wd_.toPropertiesArray), ids = ref[0], languages = ref[1], props = ref[2]; | ||
ids = wd_.normalizeIds(ids); | ||
ids = wd_.normalizeIds(forceArray(ids)); | ||
languages = forceArray(languages).map(shortLang); | ||
props = forceArray(props); | ||
if (indexOf.call(languages, 'en') < 0) { | ||
@@ -250,3 +253,3 @@ languages.push('en'); | ||
}; | ||
if ((props != null) && props.length > 0) { | ||
if ((props != null ? props.length : void 0) > 0) { | ||
query.props = props.join('|'); | ||
@@ -259,3 +262,3 @@ } | ||
},{"../utils/build_url":7,"../utils/utils":11}],6:[function(require,module,exports){ | ||
},{"../utils/build_url":7,"../utils/misc":8,"../utils/utils":12}],6:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
@@ -295,3 +298,3 @@ (function() { | ||
},{"../utils/build_url":7,"../utils/utils":11}],7:[function(require,module,exports){ | ||
},{"../utils/build_url":7,"../utils/utils":12}],7:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
@@ -320,5 +323,22 @@ (function() { | ||
},{"./querystring_lite":9,"querystring":3}],8:[function(require,module,exports){ | ||
},{"./querystring_lite":10,"querystring":3}],8:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
(function() { | ||
module.exports = { | ||
shortLang: function(language) { | ||
return language.slice(0, 3); | ||
}, | ||
forceArray: function(array) { | ||
if (typeof array === 'string') { | ||
array = [array]; | ||
} | ||
return array || []; | ||
} | ||
}; | ||
}).call(this); | ||
},{}],9:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
(function() { | ||
var simplifyClaims, wd_; | ||
@@ -356,3 +376,3 @@ | ||
},{"./simplify_claims":10,"./utils":11}],9:[function(require,module,exports){ | ||
},{"./simplify_claims":11,"./utils":12}],10:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
@@ -380,3 +400,3 @@ (function() { | ||
},{}],10:[function(require,module,exports){ | ||
},{}],11:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
@@ -408,2 +428,5 @@ (function() { | ||
break; | ||
case 'monolingualtext': | ||
value = datavalue.value.text; | ||
break; | ||
case 'wikibase-item': | ||
@@ -426,3 +449,3 @@ value = 'Q' + datavalue.value['numeric-id']; | ||
},{"./utils":11}],11:[function(require,module,exports){ | ||
},{"./utils":12}],12:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
@@ -502,10 +525,2 @@ (function() { | ||
wd_.toPropertiesArray = function(obj) { | ||
if (typeof obj === 'string') { | ||
return obj = [obj]; | ||
} else { | ||
return obj || []; | ||
} | ||
}; | ||
module.exports = wd_; | ||
@@ -515,3 +530,3 @@ | ||
},{}],12:[function(require,module,exports){ | ||
},{}],13:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
@@ -530,3 +545,3 @@ (function() { | ||
},{"./queries/wdq_get_reverse_claims":4,"./queries/wikidata_get_entities":5,"./queries/wikidata_search_entities":6,"./utils/parse_responses":8,"./utils/simplify_claims":10,"./utils/utils":11}]},{},[12])(12) | ||
},{"./queries/wdq_get_reverse_claims":4,"./queries/wikidata_get_entities":5,"./queries/wikidata_search_entities":6,"./utils/parse_responses":9,"./utils/simplify_claims":11,"./utils/utils":12}]},{},[13])(13) | ||
}); |
{ | ||
"name": "wikidata-sdk", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "a javascript tool suite to query and work with wikidata data", | ||
@@ -11,4 +11,6 @@ "main": "build/wikidata-sdk.js", | ||
"test": "mocha --compilers coffee:coffee-script/register --watch", | ||
"build": "coffee --watch -o build -c src", | ||
"dist": "browserify build/wikidata-sdk.js -s wdk > dist/wikidata-sdk.js" | ||
"build": "rm -rf build; coffee -o build -c src", | ||
"build-watch": "rm -rf build; coffee --watch -o build -c src", | ||
"dist": "browserify build/wikidata-sdk.js -s wdk > dist/wikidata-sdk.js", | ||
"prepublish": "npm run build; npm run dist;" | ||
}, | ||
@@ -15,0 +17,0 @@ "repository": { |
@@ -186,3 +186,2 @@  | ||
- normalizeWikidataTime (aliased to wikidataTimeToEpochTime) | ||
- toPropertiesArray | ||
@@ -189,0 +188,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
Sorry, the diff of this file is not supported yet
134532
37
2899
205