Phase 1 PWA: prayer times, qibla, quran, hijri, tasbih, 99 names

This commit is contained in:
Hermes Bot
2026-08-06 11:55:47 +08:00
parent 4def05d0ef
commit 0d37e7ec1e
10869 changed files with 959465 additions and 18 deletions
+16
View File
@@ -0,0 +1,16 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"func-style": "off",
"id-length": "off",
"max-lines-per-function": "off",
"new-cap": ["error", {
"capIsNewExceptions": [
"GetIntrinsic",
],
}],
},
}
+12
View File
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/own-keys
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+9
View File
@@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}
+33
View File
@@ -0,0 +1,33 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.2](https://github.com/ljharb/own-keys/compare/v1.0.1...v1.0.2) - 2026-07-21
### Commits
- [Fix] preserve own-key insertion order when the platform's key enumeration does not [`29950ec`](https://github.com/ljharb/own-keys/commit/29950ecffbfe74a94ccfdcfe5066e19206078d52)
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/eslint`, `@types/has-property-descriptors`, `auto-changelog`, `eslint`, `evalmd`, `npmignore`, `tape` [`431250c`](https://github.com/ljharb/own-keys/commit/431250cb85e78ca8deba28875edd59e0c11149ef)
- [Deps] update `get-intrinsic` [`d1c3396`](https://github.com/ljharb/own-keys/commit/d1c3396801f0d976f13b2c4fb323c95ca5c214e3)
- [types] fix an error TS v6 ignores but v7 fails on [`ae0c7fe`](https://github.com/ljharb/own-keys/commit/ae0c7fe3f8a871f50f9b7daf46298f0ef33cc75c)
- [readme] replace runkit CI badge with shields.io check-runs badge [`5caf6ed`](https://github.com/ljharb/own-keys/commit/5caf6edb73d4ff65ecd491521ef7094c08805061)
## [v1.0.1](https://github.com/ljharb/own-keys/compare/v1.0.0...v1.0.1) - 2024-12-29
### Commits
- [Tests] sort with a proper comparator [`4a65b56`](https://github.com/ljharb/own-keys/commit/4a65b569d10985032a0773806dcdec8866132baa)
- [Fix] fix function name when `Reflect.ownKeys` is absent [`5cf17cb`](https://github.com/ljharb/own-keys/commit/5cf17cb1c9adfa836a1ddc467da4da20973db2ae)
## v1.0.0 - 2024-12-28
### Commits
- Initial implementation, tests, readme, types [`870a06f`](https://github.com/ljharb/own-keys/commit/870a06f9d7a2a6ecee283319d9a7388f8fc1c811)
- Initial commit [`70323dc`](https://github.com/ljharb/own-keys/commit/70323dc09541b4ee80426acfc89762605d7fc7bf)
- npm init [`4a3ad06`](https://github.com/ljharb/own-keys/commit/4a3ad0659defe9a67541c198743bd7733d437725)
- [Tests] node 0.8 sorts object keys differently [`b449364`](https://github.com/ljharb/own-keys/commit/b4493649ead7441fd8e65ab4718acbd088ceac70)
- Only apps should have lockfiles [`a54acbf`](https://github.com/ljharb/own-keys/commit/a54acbf2c6b8ef320abf7493b7c88002c690f9c0)
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+45
View File
@@ -0,0 +1,45 @@
# own-keys <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible.
## Getting started
```sh
npm install --save own-keys
```
## Usage/Examples
```js
var ownKeys = require('own-keys');
var assert = require('assert');
assert.deepEqual(ownKeys({ a: 1, b: 2 }), ['a', 'b']);
assert.deepEqual(ownKeys([1, 2, 3]), [0, 1, 2, 'length']);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/own-keys
[npm-version-svg]: https://versionbadg.es/ljharb/own-keys.svg
[deps-svg]: https://david-dm.org/ljharb/own-keys.svg
[deps-url]: https://david-dm.org/ljharb/own-keys
[dev-deps-svg]: https://david-dm.org/ljharb/own-keys/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/own-keys#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/own-keys.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/own-keys.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/own-keys.svg
[downloads-url]: https://npm-stat.com/charts.html?package=own-keys
[codecov-image]: https://codecov.io/gh/ljharb/own-keys/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/own-keys/
[actions-image]: https://img.shields.io/github/check-runs/ljharb/own-keys/main
[actions-url]: https://github.com/ljharb/own-keys/actions
+3
View File
@@ -0,0 +1,3 @@
declare function ownKeys<T extends Record<PropertyKey, V>, V>(object: T): (keyof T)[];
export = ownKeys;
+82
View File
@@ -0,0 +1,82 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bound');
var safePushApply = require('safe-push-apply');
var $ownKeys = GetIntrinsic('%Reflect.ownKeys%', true);
var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);
var $gOPS = GetIntrinsic('%Object.getOwnPropertySymbols%', true);
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
var keys = require('object-keys');
// eslint-disable-next-line array-bracket-newline
var order = ['b', 'd', 'a', 'c', 'g', 'e', 'h', 'f', 'j', 'i', 'l', 'k'];
/*
* Some pre-ES2015 engines (notably V8 in node 0.8) enumerate own property names
* in a per-realm randomized order rather than property-creation order, and a
* `Reflect.ownKeys`/`getOwnPropertyNames` shim layered on top (e.g. es6-shim)
* inherits that. `Object.keys` is ordered even there, so probe whichever key
* source we're about to use and reconstruct from `object-keys` when it can't be
* trusted to preserve insertion order.
*/
/** @param {(o: object) => (string | symbol)[]} getNames */
function preservesInsertionOrder(getNames) {
/** @type {Record<string, boolean>} */
var probe = {};
var got;
var i;
for (i = 0; i < order.length; i += 1) {
probe[order[i]] = true;
}
got = getNames(probe);
if (got.length !== order.length) {
return false;
}
for (i = 0; i < order.length; i += 1) {
if (got[i] !== order[i]) {
return false;
}
}
return true;
}
var nativeOwnKeys = $ownKeys && preservesInsertionOrder($ownKeys) ? $ownKeys : null;
var trustGOPNOrder = !nativeOwnKeys && $gOPN && preservesInsertionOrder($gOPN);
/** @type {typeof import('.')} */
module.exports = nativeOwnKeys || function ownKeys(source) {
/** @type {(keyof typeof source)[]} */
var sourceKeys;
var allNames;
var name;
var i;
if ($gOPN && trustGOPNOrder) {
sourceKeys = $gOPN(source);
} else {
/*
* The available key source can't be trusted to preserve order, so take the
* enumerable keys from `object-keys` (ordered) and borrow only the
* non-enumerable names from `getOwnPropertyNames` (their relative order is
* unrecoverable on such engines).
*/
sourceKeys = keys(source);
if ($gOPN) {
allNames = $gOPN(source);
for (i = 0; i < allNames.length; i += 1) {
name = allNames[i];
if (!$isEnumerable(source, name)) {
sourceKeys[sourceKeys.length] = name;
}
}
}
}
if ($gOPS) {
safePushApply(sourceKeys, $gOPS(source));
}
return sourceKeys;
};
+93
View File
@@ -0,0 +1,93 @@
{
"name": "own-keys",
"version": "1.0.2",
"description": "Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible",
"main": "index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
"prelint": "evalmd --eslint README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc && attw -P",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run lint",
"tests-only": "nyc tape test",
"test": "npm run tests-only",
"posttest": "npx npm@'>= 10.2' audit --production"
},
"keywords": [
"own",
"key",
"keys",
"propertykey",
"string",
"symbol",
"enumerable",
"non-enumerable",
"robust"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/own-keys.git"
},
"bugs": {
"url": "https://github.com/ljharb/own-keys/issues"
},
"homepage": "https://github.com/ljharb/own-keys#readme",
"dependencies": {
"call-bound": "^1.0.4",
"get-intrinsic": "^1.3.0",
"object-keys": "^1.1.1",
"safe-push-apply": "^1.0.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.5",
"@ljharb/eslint-config": "^22.2.3",
"@ljharb/tsconfig": "^0.3.2",
"@types/eslint": "^8.56.12",
"@types/get-intrinsic": "^1.2.3",
"@types/has-property-descriptors": "^1.0.3",
"@types/isarray": "^2.0.3",
"@types/node": "^12.20.55",
"@types/object-keys": "^1.0.3",
"auto-changelog": "^2.6.0",
"eslint": "^8.57.1",
"evalmd": "^0.0.22",
"has-property-descriptors": "^1.0.2",
"has-symbols": "^1.1.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.5",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.10.2",
"typescript": "next"
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}
+82
View File
@@ -0,0 +1,82 @@
'use strict';
var test = require('tape');
var hasSymbols = require('has-symbols/shams')();
var hasPropertyDescriptors = require('has-property-descriptors')();
var ownKeys = require('../');
/** @type {(a: PropertyKey, b: PropertyKey) => number} */
function comparator(a, b) {
if (typeof a === 'string' && typeof b === 'string') {
return a.localeCompare(b);
}
if (typeof a === 'number' && typeof b === 'number') {
return a - b;
}
return typeof a === 'symbol' ? 1 : -1;
}
test('ownKeys', function (t) {
t.equal(typeof ownKeys, 'function', 'is a function');
t.equal(
ownKeys.length,
1,
'has a length of 1'
);
t.test('basics', function (st) {
var obj = { a: 1, b: 2 };
if (hasPropertyDescriptors) {
Object.defineProperty(obj, 'c', {
configurable: true,
enumerable: false,
writable: true,
value: 3
});
}
st.deepEqual(
ownKeys(obj).sort(comparator),
(hasPropertyDescriptors ? ['a', 'b', 'c'] : ['a', 'b']).sort(comparator),
'includes non-enumerable properties'
);
st.end();
});
t.test('symbols', { skip: !hasSymbols }, function (st) {
/** @type {Record<PropertyKey, unknown>} */
var obj = { a: 1 };
var sym = Symbol('b');
obj[sym] = 2;
var nonEnumSym = Symbol('c');
Object.defineProperty(obj, nonEnumSym, {
configurable: true,
enumerable: false,
writable: true,
value: 3
});
st.deepEqual(
ownKeys(obj).sort(comparator),
['a', sym, nonEnumSym].sort(comparator),
'works with symbols, both enum and non-enum'
);
st.end();
});
t.test('preserves insertion order of enumerable string keys', function (st) {
st.deepEqual(
ownKeys({ d: 1, a: 2, c: 3, b: 4 }),
['d', 'a', 'c', 'b'],
'enumerable string keys are returned in insertion order'
);
st.end();
});
t.end();
});
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"target": "es2021",
},
"types": ["node"],
"exclude": [
"coverage",
],
}