PageSourceSearch

https://www.darpa.mil/themes/custom/darpa_uswds/assets/js/packages…/lib/apigatewaycore/utils.js?tlulo3

js darpa.mil collected 2026-09-24 07:03:50 UTC 2,667 bytes, 80 lines download raw bytes

1/*
2 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 *  http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 
16var apiGateway = apiGateway || {};
17apiGateway.core = apiGateway.core || {};
18
19apiGateway.core.utils = {
20    assertDefined: function (object, name) {
21        if (object === undefined) {
22            throw name + ' must be defined';
23        } else {
24            return object;
25        }
26    },
27    assertParametersDefined: function (params, keys, ignore) {
28        if (keys === undefined) {
29            return;
30        }
31        if (keys.length > 0 && params === undefined) {
32            params = {};
33        }
34        for (var i = 0; i < keys.length; i++) {
35            if(!apiGateway.core.utils.contains(ignore, keys[i])) {
36                apiGateway.core.utils.assertDefined(params[keys[i]], keys[i]);
37            }
38        }
39    },
40    parseParametersToObject: function (params, keys) {
41        if (params === undefined) {
42            return {};
43        }
44        var object = { };
45        for (var i = 0; i < keys.length; i++) {
46            object[keys[i]] = params[keys[i]];
47        }
48        return object;
49    },
50    contains: function(a, obj) {
51        if(a === undefined) { return false;}
52        var i = a.length;
53        while (i--) {
54            if (a[i] === obj) {
55                return true;
56            }
57        }
58        return false;
59    },
60    copy: function (obj) {
61        if (null == obj || "object" != typeof obj) return obj;
62        var copy = obj.constructor();
63        for (var attr in obj) {
64            if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
65        }
66        return copy;
67    },
68    mergeInto: function (baseObj, additionalProps) {
69        if (null == baseObj || "object" != typeof baseObj) return baseObj;
70        var merged = baseObj.constructor();
71        for (var attr in baseObj) {
72            if (baseObj.hasOwnProperty(attr)) merged[attr] = baseObj[attr];
73        }
74        if (null == additionalProps || "object" != typeof additionalProps) return baseObj;
75        for (attr in additionalProps) {
76            if (additionalProps.hasOwnProperty(attr)) merged[attr] = additionalProps[attr];
77        }
78        return merged;
79    }
80};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.