Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating upstream files #536

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ lunr.Builder.prototype.ref = function (ref) {
* @param {object} attributes - Optional attributes associated with this field.
* @param {number} [attributes.boost=1] - Boost applied to all terms within this field.
* @param {fieldExtractor} [attributes.extractor] - Function to extract a field from a document.
* @throws {RangeError} fieldName cannot contain unsupported characters '/'
* @throws {RangeError} fieldName is unable to contain unsupported characters '/'
*/
lunr.Builder.prototype.field = function (fieldName, attributes) {
if (/\//.test(fieldName)) {
Expand Down Expand Up @@ -292,8 +292,8 @@ lunr.Builder.prototype.createFieldVectors = function () {
scoreWithPrecision = Math.round(score * 1000) / 1000
// Converts 1.23456789 to 1.234.
// Reducing the precision so that the vectors take up less
// space when serialised. Doing it now so that they behave
// the same before and after serialisation. Also, this is
// space when serialized. Doing it now so that they behave
// the same before and after serialization. Also, this is
// the fastest approach to reducing a number's precision in
// JavaScript.

Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ lunr.Index = function (attrs) {
* For more programmatic querying use lunr.Index#query.
*
* @param {lunr.Index~QueryString} queryString - A string containing a lunr query.
* @throws {lunr.QueryParseError} If the passed query string cannot be parsed.
* @throws {lunr.QueryParseError} If the passed query string was unable to be parsed.
* @returns {lunr.Index~Result[]}
*/
lunr.Index.prototype.search = function (queryString) {
Expand Down Expand Up @@ -459,7 +459,7 @@ lunr.Index.load = function (serializedIndex) {
pipeline = lunr.Pipeline.load(serializedIndex.pipeline)

if (serializedIndex.version != lunr.version) {
lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'")
lunr.utils.warn("Version mismatch when loading serialized index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'")
}

for (var i = 0; i < serializedVectors.length; i++) {
Expand Down
22 changes: 11 additions & 11 deletions lib/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
* should return undefined, the rest of the pipeline will not be called with
* this token.
*
* For serialisation of pipelines to work, all functions used in an instance of
* For serialization of pipelines to work, all functions used in an instance of
* a pipeline should be registered with lunr.Pipeline. Registered functions can
* then be loaded. If trying to load a serialised pipeline that uses functions
* then be loaded. If trying to load a serialized pipeline that uses functions
* that are not registered an error will be thrown.
*
* If not planning on serialising the pipeline then registering pipeline functions
* If not planning on serializing the pipeline then registering pipeline functions
* is not necessary.
*
* @constructor
Expand Down Expand Up @@ -63,7 +63,7 @@ lunr.Pipeline.registeredFunctions = Object.create(null)
* Register a function with the pipeline.
*
* Functions that are used in the pipeline should be registered if the pipeline
* needs to be serialised, or a serialised pipeline needs to be loaded.
* needs to be serialized, or a serialized pipeline needs to be loaded.
*
* Registering a function does not add it to a pipeline, functions must still be
* added to instances of the pipeline for them to be used when running a pipeline.
Expand All @@ -90,24 +90,24 @@ lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
var isRegistered = fn.label && (fn.label in this.registeredFunctions)

if (!isRegistered) {
lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serializing the index.\n', fn)
}
}

/**
* Loads a previously serialised pipeline.
* Loads a previously serialized pipeline.
*
* All functions to be loaded must already be registered with lunr.Pipeline.
* If any function from the serialised data has not been registered then an
* If any function from the serialized data has not been registered then an
* error will be thrown.
*
* @param {Object} serialised - The serialised pipeline to load.
* @param {Object} serialized - The serialized pipeline to load.
* @returns {lunr.Pipeline}
*/
lunr.Pipeline.load = function (serialised) {
lunr.Pipeline.load = function (serialized) {
var pipeline = new lunr.Pipeline

serialised.forEach(function (fnName) {
serialized.forEach(function (fnName) {
var fn = lunr.Pipeline.registeredFunctions[fnName]

if (fn) {
Expand Down Expand Up @@ -252,7 +252,7 @@ lunr.Pipeline.prototype.reset = function () {
}

/**
* Returns a representation of the pipeline ready for serialisation.
* Returns a representation of the pipeline ready for serialization.
*
* Logs a warning if the function has not been registered.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ lunr.utils.asString = function (obj) {
* Clones an object.
*
* Will create a copy of an existing object such that any mutations
* on the copy cannot affect the original.
* on the copy are unable to affect the original.
*
* Only shallow objects are supported, passing a nested object to this
* function will cause a TypeError.
Expand Down
42 changes: 21 additions & 21 deletions lunr.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ lunr.utils.asString = function (obj) {
* Clones an object.
*
* Will create a copy of an existing object such that any mutations
* on the copy cannot affect the original.
* on the copy are unable to affect the original.
*
* Only shallow objects are supported, passing a nested object to this
* function will cause a TypeError.
Expand Down Expand Up @@ -487,12 +487,12 @@ lunr.tokenizer.separator = /[\s\-]+/
* should return undefined, the rest of the pipeline will not be called with
* this token.
*
* For serialisation of pipelines to work, all functions used in an instance of
* For serialization of pipelines to work, all functions used in an instance of
* a pipeline should be registered with lunr.Pipeline. Registered functions can
* then be loaded. If trying to load a serialised pipeline that uses functions
* then be loaded. If attempting to load a serialized pipeline that uses functions
* that are not registered an error will be thrown.
*
* If not planning on serialising the pipeline then registering pipeline functions
* If not planning on serializing the pipeline then registering pipeline functions
* is not necessary.
*
* @constructor
Expand Down Expand Up @@ -528,7 +528,7 @@ lunr.Pipeline.registeredFunctions = Object.create(null)
* Register a function with the pipeline.
*
* Functions that are used in the pipeline should be registered if the pipeline
* needs to be serialised, or a serialised pipeline needs to be loaded.
* needs to be serialized, or a serialized pipeline needs to be loaded.
*
* Registering a function does not add it to a pipeline, functions must still be
* added to instances of the pipeline for them to be used when running a pipeline.
Expand All @@ -555,30 +555,30 @@ lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
var isRegistered = fn.label && (fn.label in this.registeredFunctions)

if (!isRegistered) {
lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
lunr.utils.warn('Function is not registered with pipeline. This may cause errors when serializing the index.\n', fn)
}
}

/**
* Loads a previously serialised pipeline.
* Loads a previously serialized pipeline.
*
* All functions to be loaded must already be registered with lunr.Pipeline.
* If any function from the serialised data has not been registered then an
* If any function from the serialized data has not been registered then an
* error will be thrown.
*
* @param {Object} serialised - The serialised pipeline to load.
* @param {Object} serialized - The serialized pipeline to load.
* @returns {lunr.Pipeline}
*/
lunr.Pipeline.load = function (serialised) {
lunr.Pipeline.load = function (serialized) {
var pipeline = new lunr.Pipeline

serialised.forEach(function (fnName) {
serialized.forEach(function (fnName) {
var fn = lunr.Pipeline.registeredFunctions[fnName]

if (fn) {
pipeline.add(fn)
} else {
throw new Error('Cannot load unregistered function: ' + fnName)
throw new Error('An error occurred while loading unregistered function: ' + fnName)
}
})

Expand Down Expand Up @@ -615,7 +615,7 @@ lunr.Pipeline.prototype.after = function (existingFn, newFn) {

var pos = this._stack.indexOf(existingFn)
if (pos == -1) {
throw new Error('Cannot find existingFn')
throw new Error('An error occurred while finding existingFn.')
}

pos = pos + 1
Expand All @@ -636,7 +636,7 @@ lunr.Pipeline.prototype.before = function (existingFn, newFn) {

var pos = this._stack.indexOf(existingFn)
if (pos == -1) {
throw new Error('Cannot find existingFn')
throw new Error('An error occurred while finding existingFn.')
}

this._stack.splice(pos, 0, newFn)
Expand Down Expand Up @@ -717,7 +717,7 @@ lunr.Pipeline.prototype.reset = function () {
}

/**
* Returns a representation of the pipeline ready for serialisation.
* Returns a representation of the pipeline ready for serialization.
*
* Logs a warning if the function has not been registered.
*
Expand Down Expand Up @@ -1816,7 +1816,7 @@ lunr.TokenSet.Builder.prototype.minimize = function (downTo) {
node.parent.edges[node.char] = this.minimizedNodes[childKey]
} else {
// Cache the key for this node since
// we know it can't change anymore
// we know it is unable to change anymore
node.child._str = childKey

this.minimizedNodes[childKey] = node.child
Expand Down Expand Up @@ -1922,7 +1922,7 @@ lunr.Index = function (attrs) {
* For more programmatic querying use lunr.Index#query.
*
* @param {lunr.Index~QueryString} queryString - A string containing a lunr query.
* @throws {lunr.QueryParseError} If the passed query string cannot be parsed.
* @throws {lunr.QueryParseError} If the passed query string was unable to be parsed.
* @returns {lunr.Index~Result[]}
*/
lunr.Index.prototype.search = function (queryString) {
Expand Down Expand Up @@ -2286,7 +2286,7 @@ lunr.Index.load = function (serializedIndex) {
pipeline = lunr.Pipeline.load(serializedIndex.pipeline)

if (serializedIndex.version != lunr.version) {
lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'")
lunr.utils.warn("Version mismatch when loading serialized index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'")
}

for (var i = 0; i < serializedVectors.length; i++) {
Expand Down Expand Up @@ -2409,7 +2409,7 @@ lunr.Builder.prototype.ref = function (ref) {
* @param {object} attributes - Optional attributes associated with this field.
* @param {number} [attributes.boost=1] - Boost applied to all terms within this field.
* @param {fieldExtractor} [attributes.extractor] - Function to extract a field from a document.
* @throws {RangeError} fieldName cannot contain unsupported characters '/'
* @throws {RangeError} fieldName was unable to contain unsupported characters '/'
*/
lunr.Builder.prototype.field = function (fieldName, attributes) {
if (/\//.test(fieldName)) {
Expand Down Expand Up @@ -2611,8 +2611,8 @@ lunr.Builder.prototype.createFieldVectors = function () {
scoreWithPrecision = Math.round(score * 1000) / 1000
// Converts 1.23456789 to 1.234.
// Reducing the precision so that the vectors take up less
// space when serialised. Doing it now so that they behave
// the same before and after serialisation. Also, this is
// space when serialized. Doing it now so that they behave
// the same before and after serialization. Also, this is
// the fastest approach to reducing a number's precision in
// JavaScript.

Expand Down
24 changes: 12 additions & 12 deletions test/env/chai.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(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.chai = 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){
(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.chai = 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("Unable to 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){
module.exports = require('./lib/chai');

},{"./lib/chai":2}],2:[function(require,module,exports){
Expand Down Expand Up @@ -2068,8 +2068,8 @@ module.exports = function (chai, _) {
/**
* ### .sealed
*
* Asserts that the target is sealed (cannot have new properties added to it
* and its existing properties cannot be removed).
* Asserts that the target is sealed (unable to have new properties added to it
* and its existing properties are unable to be removed).
*
* var sealedObject = Object.seal({});
* var frozenObject = Object.freeze({});
Expand Down Expand Up @@ -2110,8 +2110,8 @@ module.exports = function (chai, _) {
/**
* ### .frozen
*
* Asserts that the target is frozen (cannot have new properties added to it
* and its existing properties cannot be modified).
* Asserts that the target is frozen (unable to have new properties added to it
* and its existing properties are unable to be modified).
*
* var frozenObject = Object.freeze({});
*
Expand Down Expand Up @@ -3695,8 +3695,8 @@ module.exports = function (chai, util) {
/**
* ### .isSealed(object)
*
* Asserts that `object` is sealed (cannot have new properties added to it
* and its existing properties cannot be removed).
* Asserts that `object` is sealed (unable to have new properties added to it
* and its existing properties are unable to be removed).
*
* var sealedObject = Object.seal({});
* var frozenObject = Object.seal({});
Expand Down Expand Up @@ -3738,8 +3738,8 @@ module.exports = function (chai, util) {
/**
* ### .isFrozen(object)
*
* Asserts that `object` is frozen (cannot have new properties added to it
* and its existing properties cannot be modified).
* Asserts that `object` is frozen (unable to have new properties added to it
* and its existing properties are unable to be modified).
*
* var frozenObject = Object.freeze({});
* assert.frozen(frozenObject);
Expand Down Expand Up @@ -4057,7 +4057,7 @@ var config = require('../config');
var hasProtoSupport = '__proto__' in Object;

// Without `__proto__` support, this module will need to add properties to a function.
// However, some Function.prototype methods cannot be overwritten,
// However, some Function.prototype methods are unable to be overwritten,
// and there seems no easy cross-platform way to detect them (@see chaijs/chai/issues/69).
var excludeNames = /^(?:length|name|arguments|caller)$/;

Expand Down Expand Up @@ -4903,7 +4903,7 @@ function formatValue(ctx, value, recurseTimes) {
return ret;
}

// Primitive types cannot have properties
// Primitive types are unable to have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
Expand Down Expand Up @@ -6139,4 +6139,4 @@ Library.prototype.test = function(obj, type) {
};

},{}]},{},[1])(1)
});
});